UILocalNotification not working properly

后端 未结 2 1949
误落风尘
误落风尘 2021-01-07 15:10

This is my code.is there anything that i have to add for the localNotification.? Any suggestions. Thanks in advance. I read lots of local notification tutorials. I have no i

2条回答
  •  Happy的楠姐
    2021-01-07 15:18

    The Swift way would be like this:

    UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert, categories: nil))
    

    update: Xcode 7 • Swift 2.0

    UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Alert , .Sound, .Badge], categories: nil))
    

提交回复
热议问题