In my application, I upload an mp3 file to the library / caches. This file cannot be played by AVAudioPlayer using FileURL, samleCode:
_audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error];
if (error) {
NSLog(@"%@",[error localizedDescription]);
}
_audioPlayer.delegate = self;
[_audioPlayer prepareToPlay];
[_audioPlayer setNumberOfLoops:-1];
[_audioPlayer play];
The URL looks like this: File: // Localhost / Users / * /Library/Application%20Support/iPhone%20Simulator/4.3.2/Applications/1A41C5EE-04D3-4C95-BAFE-9B6E04535F8F/Library/Caches/etude.mp3
When launched, these methods call - audioPlayerDecodeErrorDidOccur: error :. Description: The operation could not be completed. (OSStatus error 560100710.) Google does not say anything about this error code.
However, this file can be played in iTunes and AVAudioPlayer when added to the Bundle application. I just can't understand. Can someone tell me how to fix this?