Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase does not map APNs token to FCM token in second installation of application #6766

Closed
shayantabatabaee opened this issue Oct 19, 2020 · 15 comments

Comments

@shayantabatabaee
Copy link

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 11.6 And 12 (Tested with both)
  • Firebase SDK version: 6.30.0
  • Firebase Component: Messaging
  • Component version: 6.30.0
  • Installation method: CocoaPods

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

Hello everyone,
I faced an issue that when I install iOS application for the second time and so on, the firebase SDK does not map FCM token to APN token correctly.
For the first time everything works great and I can push to application via both FCM token and APN token. In the second installation I can not push to application via FCM token but APN token works correctly.
I tested to register my APN token with Google Server API and the token that I retrieve from server is different with the token that I retrieve from inside application. It is interesting to tell that token that I retrieve from server works.
I also tested method swizzling but it did not work.

Relevant Code:

Here is my Firebase Debug Full Log:

2020-10-19 11:04:20.592199+0330 dara[6317:2115277] 6.30.0 - [Firebase/Core][I-COR000001] Configuring the default app.
2020-10-19 11:04:20.598203+0330 dara[6317:2115277] 6.30.0 - [Firebase/Core][I-COR000033] Data Collection flag is not set.
2020-10-19 11:04:20.634967+0330 dara[6317:2115274] 6.30.0 - [Firebase/Analytics][I-ACS024001] Debug mode is off
2020-10-19 11:04:20.635053+0330 dara[6317:2115274] 6.30.0 - [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at http://goo.gl/9vSsPb
2020-10-19 11:04:20.636542+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60702000 started
2020-10-19 11:04:20.636988+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2020-10-19 11:04:20.637399+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023009] Debug logging enabled
2020-10-19 11:04:20.637471+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023207] To enable verbose logging set the following application argument: -FIRAnalyticsVerboseLoggingEnabled (see http://goo.gl/RfcP7r)
2020-10-19 11:04:20.640612+0330 dara[6317:2115263] 6.30.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:20.642392+0330 dara[6317:2115274] 6.30.0 - [Firebase/InstanceID][I-IID023000] Info is not found in Keychain. OSStatus: -25300. Keychain query: {
2020-10-19 11:04:20.643026+0330 dara[6317:2115274] 6.30.0 - [Firebase/InstanceID][I-IID023000] Info is not found in Keychain. OSStatus: -25300. Keychain query: {
2020-10-19 11:04:20.643425+0330 dara[6317:2115274] 6.30.0 - [Firebase/InstanceID][I-IID007006] Checkin parameters: {
2020-10-19 11:04:20.644605+0330 dara[6317:2115275] 6.30.0 - [Firebase/InstanceID][I-IID005004] Checkin is in progress
11:04:20.645235+0330 dara[6317:2115275] 6.30.0 - [Firebase/Messaging][I-FCM002000] FIRMessaging library version 4.6.2
2020-10-19 11:04:20.652523+0330 dara[6317:2115275] 6.30.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
2020-10-19 11:04:20.873866+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 9.999971985816956
2020-10-19 11:04:20.921000+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS031025] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2020-10-19 11:04:21.100303+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNSplashScreen, -7296444583548067707
2020-10-19 11:04:21.100407+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-19 11:04:21.101669+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2020-10-19 11:04:21.101804+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNSplashScreen, -7296444583548067707
2020-10-19 11:04:21.119410+0330 dara[6317:2115269] 6.30.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:21.146103+0330 dara[6317:2115263] 6.30.0 - [Firebase/Installations][I-FIS001001] Sending request: <NSMutableURLRequest: 0x283340cc0> { URL: https://firebaseinstallations.googleapis.com/v1/projects/dara-71ef1/installations/ }, body:{"appId":"1:398151505418:ios:fe36dc08007c241fb171f3","fid":"fYZk9S-AeUtWnV54s5AfNt","authVersion":"FIS_v2","sdkVersion":"i:1.7.0"}, headers: {
    "X-firebase-client" = "apple-platform/ios apple-sdk/17G64 fire-analytics/6.7.2 fire-fcm/4.6.2 fire-iid/4.8.0 fire-install/1.7.0 fire-ios/6.10.0 react-native-firebase/8.4.5 swift/true xcode/11E708";
    "X-firebase-client-log-type" = 3;
2020-10-19 11:04:21.320026+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2020-10-19 11:04:21.320261+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS029017] Configuration was not found in database. The configuration will be fetched from the network when necessary
2020-10-19 11:04:21.320968+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS023016] Analytics is ready to receive events
2020-10-19 11:04:21.330472+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _fi, 1
2020-10-19 11:04:21.332989+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _fot, 1603094400000
2020-10-19 11:04:21.334505+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _f, {
2020-10-19 11:04:21.349561+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _f, {
2020-10-19 11:04:21.352763+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 13.85420000553131
2020-10-19 11:04:21.359941+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _sid, 1603092860
2020-10-19 11:04:21.363672+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _sno, 1
2020-10-19 11:04:21.364287+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _s, {
2020-10-19 11:04:21.367738+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _s, {
2020-10-19 11:04:21.369610+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:04:21.369690+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 13.83724594116211
2020-10-19 11:04:21.370136+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _e, {
2020-10-19 11:04:21.373705+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _e, {
2020-10-19 11:04:21.375934+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:04:21.376005+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 13.83095598220825
2020-10-19 11:04:21.379679+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
2020-10-19 11:04:21.380916+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:04:21.380956+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 13.82593894004822
2020-10-19 11:04:21.381142+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2020-10-19 11:04:21.498400+0330 dara[6317:2115275] 6.30.0 - [Firebase/InstanceID][I-IID007002] Invalid last checkin timestamp 2020-10-19 07:34:21 +0000 in future.
2020-10-19 11:04:21.498501+0330 dara[6317:2115275] 6.30.0 - [Firebase/InstanceID][I-IID007003] Checkin successful with authId: 5755014659310761615, digest: HH0uDwPmJf7UF1YIhfcq3g==, lastCheckinTimestamp: 1603092861000
2020-10-19 11:04:21.498657+0330 dara[6317:2115275] 6.30.0 - [Firebase/InstanceID][I-IID005004] Successfully got checkin credentials
2020-10-19 11:04:21.504024+0330 dara[6317:2115270] 6.30.0 - [Firebase/InstanceID][I-IID008010] Checkin plist file is saved
2020-10-19 11:04:21.505270+0330 dara[6317:2115269] 6.30.0 - [Firebase/InstanceID][I-IID023002] Couldn't delete item from Keychain OSStatus: -25300 with the keychain query {
2020-10-19 11:04:21.508246+0330 dara[6317:2115270] 6.30.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:21.508308+0330 dara[6317:2115270] 6.30.0 - [Firebase/InstanceID][I-IID005002] Checkin success.
2020-10-19 11:04:21.508650+0330 dara[6317:2115270] 6.30.0 - [Firebase/InstanceID][I-IID014000] Fetch new token for authorizedEntity: 398151505418, scope: *
2020-10-19 11:04:21.830643+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNSideMenuController, -7296444583548067706
2020-10-19 11:04:21.830708+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-19 11:04:21.830738+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNSideMenuController, -7296444583548067706
2020-10-19 11:04:21.831440+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNComponentViewController, -7296444583548067705
2020-10-19 11:04:21.831503+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-19 11:04:21.831580+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -7296444583548067705
2020-10-19 11:04:21.928893+0330 dara[6317:2115270] 6.30.0 - [Firebase/Installations][I-FIS001003] Request response received: <NSMutableURLRequest: 0x283340cc0> { URL: https://firebaseinstallations.googleapis.com/v1/projects/dara-71ef1/installations/ }, error: (null), body: {
2020-10-19 11:04:21.970925+0330 dara[6317:2115263] 6.30.0 - [Firebase/Installations][I-FIS001005] Parsing server response for https://firebaseinstallations.googleapis.com/v1/projects/dara-71ef1/installations/.
2020-10-19 11:04:21.971460+0330 dara[6317:2115263] 6.30.0 - [Firebase/Installations][I-FIS001007] FIRInstallationsItem parsed successfully.
2020-10-19 11:04:22.018500+0330 dara[6317:2115269] 6.30.0 - [Firebase/InstanceID][I-IID020000] Register request to https://fcmtoken.googleapis.com/register content: X-osv=14.0.1&device=5755014659310761615&X-scope=*&plat=2&app=com.tosan.dara.tosan&app_ver=1.0.0&X-cliv=fiid-4.6.2&sender=398151505418&X-subtype=398151505418&appid=fYZk9S-AeUtWnV54s5AfNt&gmp_app_id=1:398151505418:ios:fe36dc08007c241fb171f3
2020-10-19 11:04:22.678558+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNSideMenuController, -7296444583548067704
2020-10-19 11:04:22.678618+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-19 11:04:22.678692+0330 dara[6317:2115275] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNSideMenuController, -7296444583548067704
2020-10-19 11:04:22.679072+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNComponentViewController, -7296444583548067703
2020-10-19 11:04:22.679655+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-19 11:04:22.679849+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -7296444583548067703
2020-10-19 11:04:22.679973+0330 dara[6317:2115270] 6.30.0 - [Firebase/InstanceID][I-IID023002] Couldn't delete item from Keychain OSStatus: -25300 with the keychain query {
2020-10-19 11:04:22.684868+0330 dara[6317:2115263] 6.30.0 - [Firebase/InstanceID][I-IID014001] Token fetch successful, token: fYZk9S-AeUtWnV54s5AfNt:APA91bE4xJwtngJwRAfGWaGBInWbFY9ejOKaIMrPPBmvJZPAZHs77HNZTpyGak7JjhVGAty9Cve2C7ZTGs1QrerY1MDF1zgM6vMQ1KIQgjFZgQ0SXrKZrGxZZc2_0C_meewaGRYS5bRY, authorizedEntity: 398151505418, scope:*
2020-10-19 11:04:22.685377+0330 dara[6317:2115263] 6.30.0 - [Firebase/InstanceID][I-IID003010] Successfully fetched default token.
2020-10-19 11:04:22.685481+0330 dara[6317:2115263] 6.30.0 - [Firebase/InstanceID][I-IID003008] Got default token fYZk9S-AeUtWnV54s5AfNt:APA91bE4xJwtngJwRAfGWaGBInWbFY9ejOKaIMrPPBmvJZPAZHs77HNZTpyGak7JjhVGAty9Cve2C7ZTGs1QrerY1MDF1zgM6vMQ1KIQgjFZgQ0SXrKZrGxZZc2_0C_meewaGRYS5bRY
2020-10-19 11:04:22.897261+0330 dara[6317:2115277] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -7296444583548067703
2020-10-19 11:04:23.842429+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNComponentViewController, -7296444583548067702
2020-10-19 11:04:23.842705+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-19 11:04:23.842768+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -7296444583548067702
2020-10-19 11:04:24.753 [warn][tid:com.facebook.react.JavaScript] Usage of "messaging().registerDeviceForRemoteMessages()" is not required. You only need to register if auto-registration is disabled in your 'firebase.json' configuration file via the 'messaging_ios_auto_register_for_remote_messages' property.
2020-10-19 11:04:24.785354+0330 dara[6317:2115277] 6.30.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:24.785537+0330 dara[6317:2115277] 6.30.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:24.797452+0330 dara[6317:2115279] 6.30.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:24.797756+0330 dara[6317:2115279] 6.30.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:24.799193+0330 dara[6317:2115279] 6.30.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:24.800427+0330 dara[6317:2115270] 6.30.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-19 11:04:24.801437+0330 dara[6317:2115275] 6.30.0 - [Firebase/Messaging][I-FCM017000] Topic subscription request: sender=fYZk9S-AeUtWnV54s5AfNt:APA91bE4xJwtngJwRAfGWaGBInWbFY9ejOKaIMrPPBmvJZPAZHs77HNZTpyGak7JjhVGAty9Cve2C7ZTGs1QrerY1MDF1zgM6vMQ1KIQgjFZgQ0SXrKZrGxZZc2_0C_meewaGRYS5bRY&app=com.tosan.dara.tosan&device=5755014659310761615&app_ver=1.0.0&X-gcm.topic=/topics/general&X-scope=/topics/general
2020-10-19 11:04:24.805769+0330 dara[6317:2115279] 6.30.0 - [Firebase/Messaging][I-FCM017000] Topic subscription request: sender=fYZk9S-AeUtWnV54s5AfNt:APA91bE4xJwtngJwRAfGWaGBInWbFY9ejOKaIMrPPBmvJZPAZHs77HNZTpyGak7JjhVGAty9Cve2C7ZTGs1QrerY1MDF1zgM6vMQ1KIQgjFZgQ0SXrKZrGxZZc2_0C_meewaGRYS5bRY&app=com.tosan.dara.tosan&device=5755014659310761615&app_ver=1.0.0&X-gcm.topic=/topics/mobileBank_general&X-scope=/topics/mobileBank_general
2020-10-19 11:04:25.599449+0330 dara[6317:2115269] 6.30.0 - [Firebase/Messaging][I-FCM004003] Successfully subscribed to topic /topics/general
2020-10-19 11:04:25.641282+0330 dara[6317:2115279] 6.30.0 - [Firebase/Messaging][I-FCM004003] Successfully subscribed to topic /topics/mobileBank_general
2020-10-19 11:04:26.073651+0330 dara[6317:2115269] 6.30.0 - [Firebase/InstanceID][I-IID003012] Provisioning profile has specifically provisioned devices, most likely a Dev profile.
2020-10-19 11:04:26.073779+0330 dara[6317:2115269] 6.30.0 - [Firebase/InstanceID][I-IID003013] APNS Environment in profile: development
2020-10-19 11:04:26.075794+0330 dara[6317:2115269] 6.30.0 - [Firebase/InstanceID][I-IID023000] Info is not found in Keychain. OSStatus: -25300. Keychain query: {
2020-10-19 11:04:26.206250+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS002002] Engagement timer scheduled to fire in approx. (s): 3600
2020-10-19 11:04:26.208675+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _vs, {
2020-10-19 11:04:26.240651+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _vs, {
2020-10-19 11:04:26.425655+0330 dara[6317:2115279] 6.30.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -7296444583548067702
2020-10-19 11:04:30.874743+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS002001] APMExperimentAlarm fired
2020-10-19 11:04:30.874847+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS002003] APMExperimentAlarm canceled
2020-10-19 11:04:31.468048+0330 dara[6317:2115277] 6.30.0 - [Firebase/Analytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 14399.97864305973
2020-10-19 11:04:35.286034+0330 dara[6317:2115274] 6.30.0 - [Firebase/Analytics][I-ACS002001] Measurement timer fired
2020-10-19 11:04:35.286190+0330 dara[6317:2115274] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:04:35.296444+0330 dara[6317:2115277] 6.30.0 - [Firebase/Analytics][I-ACS900001] Downloading data. Host: https://app-measurement.com/config/app/1:398151505418:ios:fe36dc08007c241fb171f3?platform=ios&app_instance_id=21BADBCC085044A6B67F741FC5BEFE64&gmp_version=60702
2020-10-19 11:04:35.842405+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS901006] Received SSL challenge for host. Host: https://app-measurement.com/config/app/1:398151505418:ios:fe36dc08007c241fb171f3?platform=ios&app_instance_id=21BADBCC085044A6B67F741FC5BEFE64&gmp_version=60702
2020-10-19 11:04:36.092363+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS029014] Successfully parsed a configuration. Version: 1601729033496339
2020-10-19 11:04:36.100383+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023105] Event is not subject to real-time event count daily limit. Marking an event as real-time. Event name, parameters: _f, {
2020-10-19 11:04:36.104957+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 328
2020-10-19 11:04:36.105140+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 1, 1603092860206
2020-10-19 11:04:36.111924+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _lte, 1
2020-10-19 11:04:36.112455+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _se, 1
2020-10-19 11:04:36.115610+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 446
2020-10-19 11:04:36.115872+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 2, 1603092866207
2020-10-19 11:04:36.120213+0330 dara[6317:2115269] 6.30.0 - [Firebase/Analytics][I-ACS023039] Measurement data sent to network. Timestamp (ms), data: 1603092876119, <APMPBMeasurementBatch: 0x2833499b0>
2020-10-19 11:04:36.124385+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS900000] Uploading data. Host: https://app-measurement.com/a
2020-10-19 11:04:36.428066+0330 dara[6317:2115274] 6.30.0 - [Firebase/Analytics][I-ACS901006] Received SSL challenge for host. Host: https://app-measurement.com/a
2020-10-19 11:04:36.662961+0330 dara[6317:2115270] 6.30.0 - [Firebase/Analytics][I-ACS023044] Successful upload. Got network response. Code, size: 204, -1
2020-10-19 11:04:36.668885+0330 dara[6317:2115263] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 9.992522835731506
2020-10-19 11:04:36.681139+0330 dara[6317:2115274] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:06:19.121790+0330 dara[6317:2116276] 6.30.0 - [Firebase/Analytics][I-ACS002003] Engagement timer canceled
2020-10-19 11:06:19.121877+0330 dara[6317:2116276] 6.30.0 - [Firebase/Analytics][I-ACS002002] Engagement timer scheduled to fire in approx. (s): 3600
2020-10-19 11:06:19.122650+0330 dara[6317:2116276] 6.30.0 - [Firebase/Analytics][I-ACS002003] Engagement timer canceled
2020-10-19 11:06:19.215157+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _e, {
2020-10-19 11:06:19.267235+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _e, {
2020-10-19 11:06:19.270153+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 3497.391204833984
2020-10-19 11:06:19.270596+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _ab, {
2020-10-19 11:06:19.274124+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _ab, {
2020-10-19 11:06:19.276474+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:06:19.276534+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 3497.384779930115
2020-10-19 11:06:19.283668+0330 dara[6317:2116085] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _lte, 112914
2020-10-19 11:06:19.284089+0330 dara[6317:2116085] 6.30.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _se, 112914
2020-10-19 11:06:19.286910+0330 dara[6317:2116085] 6.30.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 442
2020-10-19 11:06:19.287050+0330 dara[6317:2116085] 6.30.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 3, 1603092979120
2020-10-19 11:06:19.289597+0330 dara[6317:2116085] 6.30.0 - [Firebase/Analytics][I-ACS023039] Measurement data sent to network. Timestamp (ms), data: 1603092979289, <APMPBMeasurementBatch: 0x283341f80>
2020-10-19 11:06:19.292298+0330 dara[6317:2116085] 6.30.0 - [Firebase/Analytics][I-ACS900000] Uploading data. Host: https://app-measurement.com/a
2020-10-19 11:06:19.639707+0330 dara[6317:2116312] 6.30.0 - [Firebase/Analytics][I-ACS901006] Received SSL challenge for host. Host: https://app-measurement.com/a
2020-10-19 11:06:20.090474+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS023044] Successful upload. Got network response. Code, size: 204, -1
2020-10-19 11:06:20.100189+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:06:20.100344+0330 dara[6317:2116314] 6.30.0 - [Firebase/Analytics][I-ACS023142] Cancelling background upload task. Task ID : 14
2020-10-19 11:06:26.171679+0330 dara[6317:2116276] [connection] nw_resolver_start_query_timer_block_invoke [C21] Query fired: did not receive all answers in time for firebaseinstallations.googleapis.com:443
2020-10-19 11:06:26.464102+0330 dara[6317:2116085] 6.30.0 - [Firebase/Analytics][I-ACS002002] Engagement timer scheduled to fire in approx. (s): 3600
2020-10-19 11:07:16.769785+0330 dara[6317:2116713] 6.30.0 - [Firebase/Messaging][I-FCM018001] Device has capacity 61015 MB with 15770 MB free.
2020-10-19 11:07:16.770558+0330 dara[6317:2116713] 6.30.0 - [Firebase/Messaging][I-FCM006000] Received message missing local start time, dropped.
2020-10-19 11:07:16.770639+0330 dara[6317:2116713] 6.30.0 - [Firebase/Messaging][I-FCM019005] FIRMessagingAnalytics: Sending event: _nf params: {
2020-10-19 11:07:16.771231+0330 dara[6317:2116713] 6.30.0 - [Firebase/Messaging][I-FCM006000] Received message missing local start time, dropped.
2020-10-19 11:07:16.772917+0330 dara[6317:2116563] 6.30.0 - [Firebase/Messaging][I-FCM016004] Added sync message to cache: 1603093036592529
2020-10-19 11:07:16.826660+0330 dara[6317:2116738] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: fcm, _nf, {
2020-10-19 11:07:16.892010+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _nf, {
2020-10-19 11:07:16.895682+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 3543.194695949554
2020-10-19 11:07:17.297459+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: UIAlertController, -7296444583548067701
2020-10-19 11:07:17.298896+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS002003] Engagement timer canceled
2020-10-19 11:07:17.298947+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS002002] Engagement timer scheduled to fire in approx. (s): 3600
2020-10-19 11:07:17.300045+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _e, {
2020-10-19 11:07:17.307973+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _e, {
2020-10-19 11:07:17.311061+0330 dara[6317:2116738] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:07:17.311136+0330 dara[6317:2116738] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 3542.779326915741
2020-10-19 11:07:17.311878+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _vs, {
2020-10-19 11:07:17.316223+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _vs, {
2020-10-19 11:07:17.319355+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:07:17.319681+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 3542.771024942398
2020-10-19 11:07:19.413238+0330 dara[6317:2116715] 6.30.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNComponentViewController, -7296444583548067702
2020-10-19 11:07:19.415250+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS002003] Engagement timer canceled
2020-10-19 11:07:19.415651+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS002002] Engagement timer scheduled to fire in approx. (s): 3600
2020-10-19 11:07:19.416533+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _e, {
2020-10-19 11:07:19.423610+0330 dara[6317:2116563] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _e, {
2020-10-19 11:07:19.426819+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:07:19.426879+0330 dara[6317:2116737] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 3540.663610935211
2020-10-19 11:07:19.427787+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _vs, {
2020-10-19 11:07:19.431109+0330 dara[6317:2116563] 6.30.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _vs, {
2020-10-19 11:07:19.432858+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-19 11:07:19.432896+0330 dara[6317:2116713] 6.30.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 3540.657490849495

Here is My FCM Token Log :

2020-10-19 11:04:22.684997+0330 dara[6317:2115062] FCM registration token: fYZk9S-AeUtWnV54s5AfNt:APA91bE4xJwtngJwRAfGWaGBInWbFY9ejOKaIMrPPBmvJZPAZHs77HNZTpyGak7JjhVGAty9Cve2C7ZTGs1QrerY1MDF1zgM6vMQ1KIQgjFZgQ0SXrKZrGxZZc2_0C_meewaGRYS5bRY

My APN Token Log:

2020-10-19 11:04:26.059656+0330 dara[6317:2115062] APN token:e3f9c5ed4674ae556f6be8c844ff2127d8d7b91a91f012fa6038a9b5518febfc

My Request and Response to Google server API:

Request :
{
    "application": "com.tosan.dara.tosan",
    "sandbox": true,
    "apns_tokens": [
        "e3f9c5ed4674ae556f6be8c844ff2127d8d7b91a91f012fa6038a9b5518febfc"
    ]
} 

Response :
{
    "results": [
        {
            "registration_token": "fPGfx4fy920:APA91bGHHs3MA9FA7GzW0Z8vKkRx7RqpcTSEtjqHXq2BZZ3wEFnP52o4ErnxJrzYbiiNPpNyjTmaBcyZQ1yicHBh6oBoSDnTs0jVYQGhhATJtd_xNnsAQgDNx8P4Bv2S6AzVyQ0EkjE7",
            "apns_token": "e3f9c5ed4674ae556f6be8c844ff2127d8d7b91a91f012fa6038a9b5518febfc",
            "status": "OK"
        }
    ]
} 

As you can see the FCM token from google server and application is different.

@shayantabatabaee
Copy link
Author

I've find out that if I open the application for second time or third time firebase successfully register APN token and refresh my FCM token.
But I need to register APN token at the first time.

@morganchen12
Copy link
Contributor

Can you check if the patch in #6553 fixes this issue as well?

@trungnguyen1791
Copy link

Can you check if the patch in #6553 fixes this issue as well?

Are there any cases that cachedTokenIfAvailable return a token but cachedTokenInfos return nil ? Therefor if ([self.tokenManager checkTokenRefreshPolicyWithIID:identifier]) can't clean up expired tokens.

I'm facing a problem that at the first fresh install, i got a old token and push will not work. But the second fresh install or just second run -> new token fetched -> push work normal.

@shayantabatabaee
Copy link
Author

Can you check if the patch in #6553 fixes this issue as well?

Thanks for your response, unfortunately I've applied the patch (Just change my FIRInstanceID.m file) and it did not work. There is a delay in my code between calling [FIRApp configure] and calling registerForRemoteNotifications.

After I calling registerForRemoteNotifications the APN token fetched successfully and didRegisterForRemoteNotificationsWithDeviceToken method called. But firebase did not renew token and map to new APN token.

@shayantabatabaee
Copy link
Author

After a lots of debugging in firebase iOS SDK , I figured it out that inside class FIRInstanceIDTokenManager.m inside method updateTokensToAPNSDeviceToken the *tokenInfos variable's length is 0. It seems that if there is a delay between fetching APN token and FCM token , after the APN token has been fetched this variable should has 1 old FCM token. I do not know that this causes the problem but I will keep debugging.

@shayantabatabaee
Copy link
Author

It seems that if I force firebase to refresh token something like below code it will work, but i think it is not a permanent solution.

Here is my part of AppDelegate.m class:

- (void)application:(UIApplication *)app
        didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {

  //[FIRMessaging messaging].APNSToken = devToken;
  
  [[FIRInstanceID instanceID] tokenWithAuthorizedEntity:@"********" scope:kFIRInstanceIDScopeFirebaseMessaging options:@{@"apns_token": devToken} handler:^(NSString * _Nullable token, NSError * _Nullable error) {
      NSLog(@"Error in refetching token:%@", error);
    // Fetch the token or error
}];

  NSUInteger dataLength = devToken.length;
  if (dataLength == 0) {
    return;
  }
  const unsigned char *dataBuffer = (const unsigned char *)devToken.bytes;
  NSMutableString *hexString  = [NSMutableString stringWithCapacity:(dataLength * 2)];
  for (int i = 0; i < dataLength; ++i) {
    [hexString appendFormat:@"%02x", dataBuffer[i]];
  }
  NSLog(@"APN token:%@", hexString);
}

But I will keep testing.

@morganchen12
Copy link
Contributor

Thanks for the detailed investigation @shayantabatabaee. @chliangGoogle can you take a look?

@charlotteliang
Copy link
Contributor

@shayantabatabaee Can you patch the change in #6669 and send us the debuglog?

To enable debug logging set the following application argument: -FIRDebugEnabled (see http://goo.gl/RfcP7r)

@shayantabatabaee
Copy link
Author

@morganchen12 and @chliangGoogle thanks for your time, yes I tested with the patch and full debug log is :

2020-10-20 23:29:50.771090+0330 dara[1314:192670] 6.34.0 - [Firebase/Core][I-COR000001] Configuring the default app.
2020-10-20 23:29:50.862980+0330 dara[1314:192677] 6.34.0 - [Firebase/Core][I-COR000033] Data Collection flag is not set.
2020-10-20 23:29:50.863073+0330 dara[1314:192677] 6.34.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:50.863103+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS024001] Debug mode is off
2020-10-20 23:29:50.863133+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at http://goo.gl/9vSsPb
2020-10-20 23:29:50.863163+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60900000 started
2020-10-20 23:29:50.864257+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2020-10-20 23:29:50.864933+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023009] Debug logging enabled
2020-10-20 23:29:50.865116+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023207] To enable verbose logging set the following application argument: -FIRAnalyticsVerboseLoggingEnabled (see http://goo.gl/RfcP7r)
2020-10-20 23:29:50.865166+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID008009] Deleted checkin plist file.
3:29:50.865268+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID007006] Checkin parameters: {
2020-10-20 23:29:50.865498+0330 dara[1314:192677] 6.34.0 - [Firebase/Messaging][I-FCM002000] FIRMessaging library version 4.7.1
0-10-20 23:29:50.865706+0330 dara[1314:192677] 6.34.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
2020-10-20 23:29:51.183817+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID013002] Removed cached checkin preferences from Keychain because this is a fresh install.
2020-10-20 23:29:51.184043+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID013006] App reset detected. Will delete server registrations.
2020-10-20 23:29:51.184306+0330 dara[1314:192677] 6.34.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:51.248460+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 9.999974966049194
2020-10-20 23:29:51.284452+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNSplashScreen, -3628088477171312220
2020-10-20 23:29:51.284534+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-20 23:29:51.284615+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNSplashScreen, -3628088477171312220
2020-10-20 23:29:51.312529+0330 dara[1314:192673] 6.34.0 - [Firebase/InstanceID][I-IID014012] Invalidating cached token for 398151505418 (*) due to token is no longer fresh.
2020-10-20 23:29:51.312655+0330 dara[1314:192673] 6.34.0 - [Firebase/InstanceID][I-IID005004] Checkin is in progress
2020-10-20 23:29:51.334640+0330 dara[1314:192677] 6.34.0 - [Firebase/Installations][I-FIS001001] Sending request: <NSMutableURLRequest: 0x2834fc670> { URL: https://firebaseinstallations.googleapis.com/v1/projects/dara-71ef1/installations/ }, body:{"appId":"1:398151505418:ios:fe36dc08007c241fb171f3","fid":"dbAoN1EVVUmpj3Vgj8-70_","authVersion":"FIS_v2","sdkVersion":"i:1.7.0"}, headers: {
    "X-firebase-client" = "apple-platform/ios apple-sdk/17G64 fire-analytics/6.9.0 fire-fcm/4.7.1 fire-iid/4.8.0 fire-install/1.7.0 fire-ios/6.10.4 react-native-firebase/8.4.6 swift/true xcode/11E708";
    "X-firebase-client-log-type" = 3;
2020-10-20 23:29:51.463358+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2020-10-20 23:29:51.463680+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS029017] Configuration was not found in database. The configuration will be fetched from the network when necessary
2020-10-20 23:29:51.463808+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023016] Analytics is ready to receive events
2020-10-20 23:29:51.479175+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _fi, 1
2020-10-20 23:29:51.510639+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _fot, 1603224000000
2020-10-20 23:29:51.512955+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _f, {
2020-10-20 23:29:51.540934+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _f, {
2020-10-20 23:29:51.543569+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 14.01439714431763
2020-10-20 23:29:51.556849+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _sid, 1603223990
2020-10-20 23:29:51.563886+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _sno, 1
2020-10-20 23:29:51.564441+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _s, {
2020-10-20 23:29:51.568582+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _s, {
2020-10-20 23:29:51.571936+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-20 23:29:51.572128+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 13.98711514472961
2020-10-20 23:29:51.573374+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _e, {
2020-10-20 23:29:51.577326+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _e, {
2020-10-20 23:29:51.587036+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-20 23:29:51.587138+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 13.97123718261719
2020-10-20 23:29:51.598771+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
2020-10-20 23:29:51.601963+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-20 23:29:51.602077+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 13.95647811889648
2020-10-20 23:29:51.602120+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2020-10-20 23:29:51.602345+0330 dara[1314:192677] 6.34.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
0 23:29:51.798300+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID007002] Invalid last checkin timestamp 2020-10-20 19:59:51 +0000 in future.
2020-10-20 23:29:51.798422+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID007003] Checkin successful with authId: 5483082389867869039, digest: xQ+yPjgEysYQwLSoJuTp/A==, lastCheckinTimestamp: 1603223991000
2020-10-20 23:29:51.798598+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID005004] Successfully got checkin credentials
2020-10-20 23:29:51.800784+0330 dara[1314:192670] 6.34.0 - [Firebase/InstanceID][I-IID008010] Checkin plist file is saved
2020-10-20 23:29:51.800945+0330 dara[1314:192670] 6.34.0 - [Firebase/InstanceID][I-IID023002] Couldn't delete item from Keychain OSStatus: -25300 with the keychain query {
2020-10-20 23:29:51.802493+0330 dara[1314:192670] 6.34.0 - [Firebase/InstanceID][I-IID005002] Checkin success.
2020-10-20 23:29:51.802542+0330 dara[1314:192670] 6.34.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:51.803003+0330 dara[1314:192675] 6.34.0 - [Firebase/InstanceID][I-IID014000] Fetch new token for authorizedEntity: 398151505418, scope: *
2020-10-20 23:29:52.052564+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNSideMenuController, -3628088477171312219
2020-10-20 23:29:52.053075+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-20 23:29:52.053446+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNSideMenuController, -3628088477171312219
2020-10-20 23:29:52.053732+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNComponentViewController, -3628088477171312218
2020-10-20 23:29:52.053933+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-20 23:29:52.054192+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -3628088477171312218
2020-10-20 23:29:52.546607+0330 dara[1314:192673] 6.34.0 - [Firebase/Installations][I-FIS001003] Request response received: <NSMutableURLRequest: 0x2834fc670> { URL: https://firebaseinstallations.googleapis.com/v1/projects/dara-71ef1/installations/ }, error: (null), body: {
2020-10-20 23:29:52.546839+0330 dara[1314:192670] 6.34.0 - [Firebase/Installations][I-FIS001005] Parsing server response for https://firebaseinstallations.googleapis.com/v1/projects/dara-71ef1/installations/.
2020-10-20 23:29:52.546893+0330 dara[1314:192670] 6.34.0 - [Firebase/Installations][I-FIS001007] FIRInstallationsItem parsed successfully.
2020-10-20 23:29:52.555487+0330 dara[1314:192670] 6.34.0 - [Firebase/InstanceID][I-IID021000] Unregister request to https://fcmtoken.googleapis.com/register content: X-osv=14.0.1&device=4776107188660600225&plat=2&app=com.tosan.dara.tosan&app_ver=1.0.0&X-cliv=fiid-4.7.1&delete=true
2020-10-20 23:29:52.922886+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNSideMenuController, -3628088477171312217
2020-10-20 23:29:52.922950+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-20 23:29:52.922978+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNSideMenuController, -3628088477171312217
2020-10-20 23:29:52.923168+0330 dara[1314:192671] 6.34.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNComponentViewController, -3628088477171312216
2020-10-20 23:29:52.923222+0330 dara[1314:192671] 6.34.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-20 23:29:52.923292+0330 dara[1314:192671] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -3628088477171312216
2020-10-20 23:29:53.136728+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -3628088477171312216
2020-10-20 23:29:53.324276+0330 dara[1314:192671] 6.34.0 - [Firebase/InstanceID][I-IID014007] Successfully deleted GCM server registrations on app reset
2020-10-20 23:29:53.324846+0330 dara[1314:192671] 6.34.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:53.325396+0330 dara[1314:192671] 6.34.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:53.350505+0330 dara[1314:192675] 6.34.0 - [Firebase/InstanceID][I-IID020000] Register request to https://fcmtoken.googleapis.com/register content: X-osv=14.0.1&device=5483082389867869039&X-scope=*&plat=2&app=com.tosan.dara.tosan&app_ver=1.0.0&X-cliv=fiid-4.7.1&sender=398151505418&X-subtype=398151505418&appid=dbAoN1EVVUmpj3Vgj8-70_&gmp_app_id=1:398151505418:ios:fe36dc08007c241fb171f3
2020-10-20 23:29:53.799729+0330 dara[1314:192677] 6.34.0 - [Firebase/InstanceID][I-IID014001] Token fetch successful, token: dbAoN1EVVUmpj3Vgj8-70_:APA91bGaSrdaY161589O1w6SGWM5FTN4N193sBZCQ3satxtU8c9IECCX6u_Sa4YwIEpld6DFKiGeGCRrUmdLLBgQDhO85gGRv0h9rQj4ThR8H70L5bE5W4RoH6pYHWfAXdX6e8fSPJdq, authorizedEntity: 398151505418, scope:*
2020-10-20 23:29:53.816889+0330 dara[1314:192675] 6.34.0 - [Firebase/InstanceID][I-IID003010] Successfully fetched default token.
2020-10-20 23:29:53.817001+0330 dara[1314:192675] 6.34.0 - [Firebase/InstanceID][I-IID003008] Got default token dbAoN1EVVUmpj3Vgj8-70_:APA91bGaSrdaY161589O1w6SGWM5FTN4N193sBZCQ3satxtU8c9IECCX6u_Sa4YwIEpld6DFKiGeGCRrUmdLLBgQDhO85gGRv0h9rQj4ThR8H70L5bE5W4RoH6pYHWfAXdX6e8fSPJdq
2020-10-20 23:29:54.069255+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS031010] Tracking view controller. Class, ID: RNNComponentViewController, -3628088477171312215
2020-10-20 23:29:54.069323+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS031013] Screen view event not logged. App is not active.
2020-10-20 23:29:54.069352+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -3628088477171312215
2020-10-20 23:29:56.871 [warn][tid:com.facebook.react.JavaScript] Usage of "messaging().registerDeviceForRemoteMessages()" is not required. You only need to register if auto-registration is disabled in your 'firebase.json' configuration file via the 'messaging_ios_auto_register_for_remote_messages' property.
2020-10-20 23:29:56.883705+0330 dara[1314:192651] 6.34.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:56.884552+0330 dara[1314:192651] 6.34.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:56.894817+0330 dara[1314:192671] 6.34.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:56.895309+0330 dara[1314:192671] 6.34.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:56.897427+0330 dara[1314:192651] 6.34.0 - [Firebase/Installations][I-FIS002000] -[FIRInstallationsIDController createGetInstallationItemPromise], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:56.899348+0330 dara[1314:192651] 6.34.0 - [Firebase/Installations][I-FIS002001] -[FIRInstallationsIDController installationWithValidAuthTokenForcingRefresh:0], appName: __FIRAPP_DEFAULT
2020-10-20 23:29:56.914153+0330 dara[1314:192671] 6.34.0 - [Firebase/Messaging][I-FCM017000] Topic subscription request: sender=dbAoN1EVVUmpj3Vgj8-70_:APA91bGaSrdaY161589O1w6SGWM5FTN4N193sBZCQ3satxtU8c9IECCX6u_Sa4YwIEpld6DFKiGeGCRrUmdLLBgQDhO85gGRv0h9rQj4ThR8H70L5bE5W4RoH6pYHWfAXdX6e8fSPJdq&app=com.tosan.dara.tosan&device=5483082389867869039&app_ver=1.0.0&X-gcm.topic=/topics/general&X-scope=/topics/general
2020-10-20 23:29:56.917463+0330 dara[1314:192670] 6.34.0 - [Firebase/Messaging][I-FCM017000] Topic subscription request: sender=dbAoN1EVVUmpj3Vgj8-70_:APA91bGaSrdaY161589O1w6SGWM5FTN4N193sBZCQ3satxtU8c9IECCX6u_Sa4YwIEpld6DFKiGeGCRrUmdLLBgQDhO85gGRv0h9rQj4ThR8H70L5bE5W4RoH6pYHWfAXdX6e8fSPJdq&app=com.tosan.dara.tosan&device=5483082389867869039&app_ver=1.0.0&X-gcm.topic=/topics/mobileBank_general&X-scope=/topics/mobileBank_general
2020-10-20 23:29:57.004731+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: RNNComponentViewController, -3628088477171312215
2020-10-20 23:29:58.671027+0330 dara[1314:192671] 6.34.0 - [Firebase/InstanceID][I-IID003012] Provisioning profile has specifically provisioned devices, most likely a Dev profile.
2020-10-20 23:29:58.671117+0330 dara[1314:192671] 6.34.0 - [Firebase/InstanceID][I-IID003013] APNS Environment in profile: development
2020-10-20 23:29:58.673086+0330 dara[1314:192671] 6.34.0 - [Firebase/InstanceID][I-IID023000] Info is not found in Keychain. OSStatus: -25300. Keychain query: {
2020-10-20 23:29:59.055255+0330 dara[1314:192675] 6.34.0 - [Firebase/Messaging][I-FCM004003] Successfully subscribed to topic /topics/mobileBank_general
2020-10-20 23:29:59.055852+0330 dara[1314:192675] 6.34.0 - [Firebase/Messaging][I-FCM004003] Successfully subscribed to topic /topics/general
2020-10-20 23:30:01.248946+0330 dara[1314:192651] 6.34.0 - [Firebase/Analytics][I-ACS002001] APMExperimentAlarm fired
2020-10-20 23:30:01.249112+0330 dara[1314:192651] 6.34.0 - [Firebase/Analytics][I-ACS002003] APMExperimentAlarm canceled
2020-10-20 23:30:01.261309+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS002002] APMExperimentAlarm scheduled to fire in approx. (s): 14399.98781180382
2020-10-20 23:30:02.302967+0330 dara[1314:192651] 6.34.0 - [Firebase/Analytics][I-ACS002002] Engagement timer scheduled to fire in approx. (s): 3600
2020-10-20 23:30:02.315960+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: auto, _vs, {
2020-10-20 23:30:02.325628+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: _vs, {
2020-10-20 23:30:05.572785+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS002001] Measurement timer fired
2020-10-20 23:30:05.573002+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-10-20 23:30:05.583599+0330 dara[1314:192651] 6.34.0 - [Firebase/Analytics][I-ACS900001] Downloading data. Host: https://app-measurement.com/config/app/1:398151505418:ios:fe36dc08007c241fb171f3?platform=ios&app_instance_id=A7F3B076DA104D7C96EAD6F0C0AACCCF&gmp_version=60900
2020-10-20 23:30:06.455767+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS901006] Received SSL challenge for host. Host: https://app-measurement.com/config/app/1:398151505418:ios:fe36dc08007c241fb171f3?platform=ios&app_instance_id=A7F3B076DA104D7C96EAD6F0C0AACCCF&gmp_version=60900
2020-10-20 23:30:06.725978+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS029014] Successfully parsed a configuration. Version: 1601729033496339
2020-10-20 23:30:06.741927+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023105] Event is not subject to real-time event count daily limit. Marking an event as real-time. Event name, parameters: _f, {
2020-10-20 23:30:06.750581+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 323
2020-10-20 23:30:06.751765+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 1, 1603223990557
2020-10-20 23:30:06.767324+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _lte, 1
2020-10-20 23:30:06.768840+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS023087] User property set. Name, value: _se, 1
2020-10-20 23:30:06.774475+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 379
2020-10-20 23:30:06.775290+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 2, 1603223990557
2020-10-20 23:30:06.792920+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 379
2020-10-20 23:30:06.793910+0330 dara[1314:192670] 6.34.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 3, 1603224002305
2020-10-20 23:30:06.803883+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS023039] Measurement data sent to network. Timestamp (ms), data: 1603224006802, <APMPBMeasurementBatch: 0x2834f52d0>
2020-10-20 23:30:06.811795+0330 dara[1314:192675] 6.34.0 - [Firebase/Analytics][I-ACS900000] Uploading data. Host: https://app-measurement.com/a
2020-10-20 23:30:07.148526+0330 dara[1314:192651] 6.34.0 - [Firebase/Analytics][I-ACS901006] Received SSL challenge for host. Host: https://app-measurement.com/a
2020-10-20 23:30:07.386265+0330 dara[1314:192668] 6.34.0 - [Firebase/Analytics][I-ACS023044] Successful upload. Got network response. Code, size: 204, -1
2020-10-20 23:30:07.389029+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 9.996587991714478
2020-10-20 23:30:07.420426+0330 dara[1314:192673] 6.34.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled

@charlotteliang
Copy link
Contributor

hmm i'm not able to reproduce. I'm able to get an APNS token after calling registerForRemoteNotification at a later time.

Can you file a customer support issue or send me your sample code at my email chliang@google.com so we can investigate more on that.

@shayantabatabaee
Copy link
Author

@chliangGoogle I'm working on creating a new project for debugging, but during the process I realized that I used one modules called RNRestart that restart my application in my splash screen. I removed restarting my application and firebase starts working but I also realized that my Firebase token at first run and the second run is different , does it seem to be normal ?
Of course I'm not sure that removing my restart modules solved the problem may be some sort of race condition happened suddenly.

@trungnguyen1791
Copy link

trungnguyen1791 commented Oct 22, 2020

@chliangGoogle Excuse me...Are there any cases that cachedTokenIfAvailable return a token but cachedTokenInfos return nil in first fresh install app?

@charlotteliang
Copy link
Contributor

@shayantabatabaee the latest version of SDK should fix it. Can you update your cocoapod and try it again?

@trungnguyen1791 What kind of issue you running into? If it's a different one, please file a separate PR.

@google-oss-bot
Copy link

Hey @shayantabatabaee. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@shayantabatabaee
Copy link
Author

@shayantabatabaee the latest version of SDK should fix it. Can you update your cocoapod and try it again?

@trungnguyen1791 What kind of issue you running into? If it's a different one, please file a separate PR.

Thanks for your help, updating the sdk fix my problem, so I close the issue

@firebase firebase locked and limited conversation to collaborators Jan 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants