views:

162

answers:

0

I observed strange behavior while working with AVAudioPlayer

Following is the code.

AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@",fileName]] error: &error];

In this, I downloaded the file from server and stored in application's Cache directory.

I am getting following error: Error in playing = Domain = NSOSStatusErrorDomain Code = -43 Description = Error Domain=NSOSStatusErrorDomain Code=-43 "The operation couldn’t be completed. (OSStatus error -43.)"

I also verified that file is present at that location. Everytime I restart my application, I was getting same error for song play After some time, when I tried to run same code, my player just works fine without any error.

Can anyone tell me how to handle this error? Also, Can anyone explain me what was the problem?

Thanks in advance...