当我运行在iOS模拟器中播放声音的应用程序时,它运行得很好。但是,当我在实际设备上运行它时,会出现以下错误:
2015-04-20 21:44:00.173 Practical11-1 [230:7753] PAEAudioFilePlayer路径:/ private / var / mobile / Containers / Bundle / Application / D9E12F4A-88F6-41FC-9A0D-A195A56285DF / Practical11-1 .app / sounds / rain.aif not found
我使用的代码是获取文件:
// An array of all available sounds
self.filenames = @[@"rain.aif",
@"storm.aif",
@"seaside.aif",
@"fire.aif",
@"nighttime.aif",
@"whitenoise.aif"];
然后:
if (index < 0 || index >= self.activeFilenames.count)
return;
// use the file name at the index to create the path
NSString* bundlePath = [@"sounds"stringByAppendingPathComponent:self.activeFilenames[index]];
有人有什么想法吗?
答案 0 :(得分:1)
在我的项目中以大写字母保存并在项目中以小写字母引用的声音文件之前,我已经遇到过此问题。即:
项目中的文件= Rain.aif 项目中的文件= rain.aif
模拟器能够解释资源并找到正确的资源,但由于区分大小写,设备会失败。