willfo
willfo

Reputation: 249

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?

Upvotes: 0

Views: 170

Answers (1)

Danny Bravo
Danny Bravo

Reputation: 4658

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. i.e:

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.

Upvotes: 1

Related Questions