我使用APNS,它在iOS 9上工作得很好。随着iOS10上新的push API的更改,我无法注册push通知,所以我插入了接下来的更改:
通过这些更改,我成功地在iOS 9和iOS 10中执行了注册,但我遇到了两个问题:
请记住,如果我关闭目标功能选项卡中的推送通知(使用相同的代码),推送返回到iOS 9上,但我不能在iOS 10上注册APNS。
发布于 2016-12-05 13:58:12
if #available(iOS 8.0, *) {
let settings: UIUserNotificationSettings = UIUserNotificationSettings (types: [.alert, .badge, .sound], categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
}else {
let types: UIRemoteNotificationType = [.alert, .badge, .sound]
application.registerForRemoteNotifications(matching: types)
}https://stackoverflow.com/questions/40971020
复制相似问题