Reputation: 31280
I recently ran into a problem that I couldn't find discussed anywhere on the internet - I was initializing an AVAudioPlayer
to play an audio file, and getting the following error:
Error Domain=NSOSStatusErrorDomain Code=-50 "Operation could not be completed. (OSStatus error -50.)
As it turns out, I had made a mistake creating my NSURL
to send to the audio player init
method, resulting in the NSURL
object being null. Stupid mistake, pretty easy to find when debugging, but I thought I'd list it here just in case someone else does the same thing.
Upvotes: 16
Views: 16606
Reputation: 69
I'm adding my version of the issue and solution because I encountered the error with a print statement. I think it was related to string interpolation and or trying to forcibly print nsattributedstrings. I attempted to do the following.
print("THE ARRAY COUNT IS : \(unwrappedResults.count)\n\n\n
THE FULL ARRAY IS THE FIRST WHOLE RESULT IS: \(unwrappedResults)\n\n\n \ (unwrappedResults[0])\n
THE ATTRIBUTED FULL TEXT IS: \(unwrappedResults[0].attributedFullText)\n\n\n
THE ATTRIBUTED PRIMARY TEXT IS: \(unwrappedResults[0].attributedPrimaryText)\n\n\n
THE ATTRIBUTED SECONDARY TEXT IS: \(unwrappedResults[0].attributedSecondaryText)\n\n\n")
something about this was incorrect and no print would occur. I would receive the error following errors in my console.
boringssl_metrics_log_metric_block_invoke(131) Failed to log metrics & boringssl_metrics_log_metric_block_invoke(133) Error Domain=NSOSStatusErrorDomain Code=-50 "Unsupported xpc type" UserInfo={NSDescription=Unsupported xpc type}
I fixed this issue by changing the way I unwrapped/the variables values. Fundamentally I think I was trying to print something using string interpolation that could not be printed and that is what caused this error.
Upvotes: 0
Reputation: 2589
Regarding the comment from Brynjar:
The Apple NSURL
Class Reference describing URLWithString
states
To create NSURL objects for file system paths, use fileURLWithPath:isDirectory: instead.
I have found that using URLWithString
for file system paths generates the error reported by pix0r and therefore could be another explanation for error code = -50
Upvotes: 7
Reputation: 14558
“ OSStatus error -50” means paramErr
, an old-style Mac error code indicating a bad parameter.
Upvotes: 19
Reputation: 31280
Make sure your NSURL
is valid, or you will get error code -50 "Operation could not be completed".
Upvotes: 1