最近將我的應用程序從以前的版本轉換爲swift 3.可以預料的是,這在我的代碼中導致了很多錯誤。我不知道如何解決下列之一: (在Appdelegate.swift
):Error.code在swift 3中不再有效的語法?
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)
}
}
給出的錯誤是錯誤類型的值沒有任何成員「代碼」。我如何解決這個問題?