简体   繁体   中英

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. 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

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

The simulator would be able to interpret the resource and find the right one but the device would fail due to case sensitivity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM