It's gotta be a bug I guess.
The following code in a very simple app. The top one works fine and the mirror below it doesn't..
Suggestions welcome. I am NOT an ace at objective C programming so when these things fail like this it drives me nuts.
The two files, 60.m4a and Horn.aiff both play fine in iTunes and when selected in the xCode navigator.
The following code in a very simple app. The top one works fine and the mirror below it doesn't..
Code:
// This method works fine.
- (IBAction)playHorn:(id)sender {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"Horn", CFSTR ("aiff"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
// This doesn't work for some reason because the function CFBundleCopyResourceURL line passes NULL back.
- (IBAction)play60m4a:(id)sender {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"60", CFSTR ("m4a"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
****
20348#($*(*@_)(*)(*
The two files, 60.m4a and Horn.aiff both play fine in iTunes and when selected in the xCode navigator.
Last edited by a moderator: