AVAudioPlayer initialization: error code -50

pix0r picture pix0r · Dec 7, 2009 · Viewed 11.8k times · Source

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.

Answer

Jens Ayton picture Jens Ayton · Dec 8, 2009

“ OSStatus error -50” means paramErr, an old-style Mac error code indicating a bad parameter.