I want to set sound in local notification when my app in foregroundmode. i m try lot of thing . please help me.
UInt32 flag = 0;
SystemSoundID soundID;
int err = AudioServicesSetProperty(kAudioServicesPropertyIsUISound,
sizeof(UInt32),
&UILocalNotificationDefaultSoundName,
sizeof(UInt32),
&flag);
NSLog(@"%d",(unsigned int)err);
AudioServicesPlaySystemSound(soundID);
If you are trying to launch a local notification with a sound you can use the
soundName
property:With
UILocalNotificationDefaultSoundName
the notification will use the default sound, use a filename instead for a custom sound.More on this property in the documentation.