0

as NSError has become Error in Swift 3.0 how do you deal with error codes? For example:

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)
        }
    }

Gives the message Value of type Error has no member code. Should I cast it to NSError?

Kex
  • 8,023
  • 9
  • 56
  • 129
  • 1
    Found two similar questions here: http://stackoverflow.com/questions/38711269/accessing-code-in-swift-3-error, and there: http://stackoverflow.com/questions/38908667/value-of-type-error-has-no-member-code?rq=1 – HHK Sep 27 '16 at 09:36
  • please put the `._code` instead of `.code` – Amit Srivastava Sep 27 '16 at 09:39

0 Answers0