Xcode 9(IOS 11)在注册推送(远程)通知时显示错误/警告.
下面是错误消息
下面是我try 过的代码:
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
if error == nil{
UIApplication.shared.registerForRemoteNotifications()
}
}
Error/Warning Line:
UIApplication.shared.registerForRemoteNotifications()
如何解决这个问题呢?