<分区>
最近将我的应用程序从以前的版本转换为 swift 3。可以预见的是,这会导致我的代码出现很多错误。我不知道如何解决以下问题:
(在 Appdelegate.swift
中):
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
if error.code == 3010 {
print("Push notifications are not supported in the iOS Simulator.\n")
} else {
print("application:didFailToRegisterForRemoteNotificationsWithError: %@\n", error)
}
}
给出的错误是类型error的值没有成员“code”。我该如何解决这个问题?