iOS device token not regenerated after migration f

2019-07-15 03:44发布

问题:

I created an APP for both iOS and Android and I used APN to get deviceToken for iOS and GCM for Android. I decided to migrate to firebase to make token management easier. I noticed a issue just for iOS application and I was wondering if someone else encountered it too. When I migrated iOS app to firebase, token was not regenerated unless the app was reinstalled. I follow the firebase guide to do it but with no result. Someone else has this problem? Thanks in advance

回答1:

I solved my problem.

  1. I switch off and switch on capabilities

  2. I restarted XCode

  3. I put FIRInstanceIDAPNSTokenType to prod and now all seems to work

    func application( _ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data ) { FIRInstanceID.instanceID().token() FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.prod) }