Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSOSStatusError

I am try to play a number of audios in my app and it is working fine upto 3 times. But when i am trying to play in 4th time it shows the error . Error Domain=NSOSStatusErrorDomain Code=-43 "The operation couldn’t be completed. (OSStatus error -43.)" .the code is

 NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/Sun.wav", [[NSBundle mainBundle] resourcePath]]];

 NSError *error;
 AudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];

 AudioPlayer.numberOfLoops = 0;

 AudioPlayer.volume=1.0;

 if (AudioPlayer == nil)
 {
    NSLog([error description]);    
 }
 else
    [AudioPlayer play];

Anybody figure it out before..?

like image 492
Sat Avatar asked May 03 '26 05:05

Sat


1 Answers

You can use the macerror command line utility to find out what an OSStatus code is:

macerror -43

Output:

Mac OS error -43 (fnfErr): File not found

i.e. the file you tried to use doesn't exist.

like image 112
Jonathan Grynspan Avatar answered May 05 '26 17:05

Jonathan Grynspan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!