相关疑难解决方法(0)

为本地通知选择自定义声音

如何更改播放本地通知的声音?我使用下面的代码播放默认声音:

notif.soundName = UILocalNotificationDefaultSoundName;
Run Code Online (Sandbox Code Playgroud)

所以,我在下面尝试了这个,它没有用.我该怎么办?谢谢你的帮助!

notif.soundName = @"sound.caf";
Run Code Online (Sandbox Code Playgroud)

iphone notifications objective-c ipad ios

31
推荐指数
4
解决办法
3万
查看次数

如何为UILocalNotification添加声音?

我已经为我的应用程序完成了基本通知.我想在我的通知中添加声音效果.

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
if (localNotification == nil)
    return;

localNotification.fireDate = [NSDate date];
//localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = msg;
localNotification.soundName = @"Morse.aiff";

[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
Run Code Online (Sandbox Code Playgroud)

如何添加音效?

ios uilocalnotification

12
推荐指数
1
解决办法
2万
查看次数