Swift 3.0 Syntax change for UIUserNotificationSettings

后端 未结 3 1074
滥情空心
滥情空心 2021-02-13 11:53

I am using swift 3.0 and am trying to add badge numbers to my app. I believe the correct way to do this is similar to what is below.

application.registerUserNoti         


        
3条回答
  •  野性不改
    2021-02-13 12:17

    It has been updated in both Swift 2 and Swift 3. This line should fix your issue. Also make sure any other lines with UIUserNotificationType have had their variables switched to lowercase.

    let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
    

提交回复
热议问题