I want to play a UILocalNotificationDefaultSoundName from
alert.soundName = UILocalNotificationDefaultSoundName;
with :
NSURL *soundFileURLRef = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"fileName" ofType:@"wav"]];
OSStatus oStatus = AudioServicesCreateSystemSoundID ((__bridge CFURLRef)soundFileURLRef, &aSoundID);
if (oStatus == kAudioServicesNoError)
AudioServicesPlaySystemSound (aSoundID);
Is there a way I can get the name and the type of a UILocalNotificationDefaultSoundName
?
System sounds are not available you your app, unfortunately. From the docs:
Note: System-supplied alert sounds and system-supplied user-interface sound effects are not available to your iOS application. For example, using the kSystemSoundID_UserPreferredAlert constant as a parameter to the AudioServicesPlayAlertSound function will not play anything.
Update
While Apple does say you can't access system sounds, I suppose they must mean that you can't access them for your own purposes, but I see that UILocalNotification.h provides:
UIKIT_EXTERN NSString *const UILocalNotificationDefaultSoundName;
"Identifies the default system sound to play when a notification alert is displayed. You assign this value to the soundName property." I am now using this in my app and it seems to work fine.