[英]Audio files working in iOS simulator, but can't be found on actual device
When I run my app which plays sound in the iOS simulator, it works perfectly. 当我运行在iOS模拟器中播放声音的应用程序时,它可以完美运行。 However when I run it on my actual device, the following error appears: 但是,当我在实际设备上运行它时,出现以下错误:
2015-04-20 21:44:00.173 Practical11-1[230:7753] PAEAudioFilePlayer path:/private/var/mobile/Containers/Bundle/Application/D9E12F4A-88F6-41FC-9A0D-A195A56285DF/Practical11-1.app/sounds/rain.aif not found 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/找不到声音/rain.aif
The code I am using is to get the files is: 我正在使用的代码来获取文件是:
// An array of all available sounds
self.filenames = @[@"rain.aif",
@"storm.aif",
@"seaside.aif",
@"fire.aif",
@"nighttime.aif",
@"whitenoise.aif"];
and then: 接着:
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]];
Does anybody have any ideas? 有人有什么想法吗?
I've had this issue before when the sound files where saved with a capital letter in my project and referenced in lowercase on my project. 在将声音文件以大写字母保存在项目中并在项目中以小写字母引用时,我遇到过这个问题。 ie: 即:
The file in the project = Rain.aif The file in the project = rain.aif 项目中的文件= Rain.aif项目中的文件= rain.aif
The simulator would be able to interpret the resource and find the right one but the device would fail due to case sensitivity. 模拟器将能够解释资源并找到正确的资源,但是由于区分大小写,设备将发生故障。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.