【发布时间】:2015-10-22 17:35:45
【问题描述】:
我正在尝试使用默认声音制作常规 UILocalNotification
这是我的功能
func makeLocalNotificationForNow(str : String , id : String)
{
let notification = UILocalNotification()
notification.alertBody = str // text that will be displayed in the notification
notification.alertAction = "open" // text that is displayed after "slide to..." on the lock screen - defaults to "slide to view"
notification.fireDate = NSDate(timeIntervalSinceNow: 5) // todo item due date (when notification will be fired)
notification.soundName = UILocalNotificationDefaultSoundName // play default sound
UIApplication.sharedApplication().scheduleLocalNotification(notification)
}
在我的 didFinishLaunchingWithOptions 函数中我放了
let settings = UIUserNotificationSettings(forTypes: [.Alert, .Badge , .Sound], categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
注意:我也使用解析推送通知
当我发出通知时,它会出现但没有警报或声音(我需要从顶部滑动才能看到通知 怎么了?!
【问题讨论】:
标签: ios arrays uilocalnotification