由于NSError
已成为Swift 3.0中的Error
,您如何处理错误代码?例如:
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
if error.code == 3010 {
print("Push notifications are not supported in the iOS Simulator.")
} else {
print("application:didFailToRegisterForRemoteNotificationsWithError: %@", error)
}
}
给出消息Value of type Error has no member code
。我应该把它投到NSError?