3

I'm building an iOS app and using Firebase Cloud Messaging to do remote notifications. I've done nothing to disable swizzling (haven't touched the FirebaseAppDelegateProxyEnabled flag), though the swizzling doesn't appear to be enabled.

The function below is what I've been using to work around the broken swizzling, manually setting the apnsToken:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    print("APNs token retrieved: \(deviceToken)")

    // Messaging.messaging().apnsToken = deviceToken
    // Auth.auth().setAPNSToken(deviceToken, type: AuthAPNSTokenType.sandbox)
}

When those two lines to manually set the apnsToken are commented out, the function below

@IBAction func fetchFCMToken(_ sender: UIButton) {
    let token = Messaging.messaging().fcmToken
    print("FCM token: \(token ?? "")")
    print("apnsToken: \(Messaging.messaging().apnsToken)")
}

outputs:

***** (the actual FCM token)
nil

With the lines setting the apnsToken not commented out, Messaging.messaging().apnsToken has a non-nil value. This doesn't appear to be the default behavior. Thanks in advance for any help!

AL.
  • 36,815
  • 10
  • 142
  • 281
bigbsg11
  • 31
  • 2

0 Answers0