蔭試圖與默認的聲音有規律UILocalNotificationIOS迅速本地通知沒有聲音
這是我的功能
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()
注
:我也使用解析推送通知
當我進行通知它似乎沒有警報或聲音(我需要從頂部滑動看到通知 有什麼問題?!