简体   繁体   English

音频文件可在iOS模拟器中运行,但无法在实际设备上找到

[英]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.

相关问题 在模拟器和实际iOS设备上存储文件 - Storing files on simulator vs actual iOS device 背景音频在iOS模拟器上可运行,但不能在设备上运行 - background audio working on iOS simulator but not device 音频和振动在模拟器中工作,而不是在ios设备上 - Audio and vibrate working in simulator not on ios device NSKeyedArchiver在模拟器上工作,但不在实际设备上 - NSKeyedArchiver working on simulator but not actual device iOS 9无法播放下载到设备上的音频/视频文件 - iOS 9 can’t play audio/video files that are downloaded to device 无法在iOS模拟器中缩放设备窗口 - Can't scale device window in iOS Simulator 适用于iOS的Dropbox SDK适用于模拟器,而不适用于实际设备 - Dropbox SDK for iOS works on simulator, not on actual device 在实际设备上发生SIGSEGV错误,但在iOS模拟器上未发生 - SIGSEGV Error occurs on the actual device but not on ios simulator iOS模拟器崩溃,设备未崩溃(模具:未找到符号) - iOS Simulator crashes, device doesn't (dyld: Symbol not found) MonoTouch iOS应用程序无法在设备目录中找到文件-在模拟器上工作 - MonoTouch iOS application can't find files in directory on device - works on simulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM