我在使用AVAudioPlayer时观察到了奇怪的行为
以下是代码:
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@",fileName]] error: &error];
Run Code Online (Sandbox Code Playgroud)
在这里,我从服务器下载了文件并存储在应用程序的Cache目录中.
我收到以下错误:
Error in playing =
Domain = NSOSStatusErrorDomain
Code = -43
Description = Error Domain=NSOSStatusErrorDomain Code=-43 "The operation couldn’t be completed. (OSStatus error -43.)"
Run Code Online (Sandbox Code Playgroud)
我还验证了该位置存在该文件.每次我重新启动我的应用程序时,我都会收到相同的歌曲播放错误.一段时间后,当我尝试运行相同的代码时,我的播放器工作正常,没有任何错误.
谁能告诉我如何处理这个错误?
此外,任何人都可以解释我的问题是什么?