Skip to content

[FirebaseMessaging] FirebaseApp.configure() triggers "APNS device token not set before retrieving FCM Token" #10742

Closed
@DanielReyesDev

Description

@DanielReyesDev

Description

I noticed that everytime an app executes the method FirebaseApp.configure(), the SDK throws the following output in the console:

APNS device token not set before retrieving FCM Token for Sender ID '804880211453'.Be sure to re-retrieve the FCM token once the APNS device token is set. 
  • is this a valid warning message? I mean, how can we event setup the APNS device token before the whole SDK initialization?

  • I noticed this behavior is also happening in older SDK version like 9.4.0

  • Additionally I noticed that automatically the SDK is making an API call to https://fcmtoken.googleapis.com/register without the apns token. The exact same call that was sending a 400 when this behavior happened last week before the rollback here: Messaging.messaging().token returns errors #10679 (comment)

  • how can we avoid that /register api call at the very beginning of the SDK initialization?

Reproducing the issue

  1. Download and configure the official quick-start ios project: https://github.com/firebase/quickstart-ios
  2. Run the app "MessagingExampleSwift" on a real iPhone
  3. You will see this error in console right after FirebaseApp.configure() is executed:
APNS device token not set before retrieving FCM Token for Sender ID '676015592495'. Notifications to this FCM Token will not be delivered over APNS.Be sure to re-retrieve the FCM token once the APNS device token is set. 

Firebase SDK Version

10.4.0

Xcode Version

13.4

Installation Method

Swift Package Manager

Firebase Product(s)

Messaging

Targeted Platforms

iOS

Relevant Log Output

2023-01-26 18:22:15.695691-0600 MessagingExampleSwift[1179:196158] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)") 2023-01-26 18:22:15.713204-0600 MessagingExampleSwift[1179:196158] [Assert] UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems. navigationController=<UINavigationController: 0x10200ea00>, navigationBar=<UINavigationBar: 0x100c07830; frame = (0 0; 0 50); opaque = NO; autoresize = W; gestureRecognizers = <NSArray: 0x283c52400>; layer = <CALayer: 0x28324aa60>> delegate=0x10200ea00 2023-01-26 18:22:15.865301-0600 MessagingExampleSwift[1179:196687] 10.4.0 - [FirebaseAnalytics][I-ACS023007] Analytics v.10.4.0 started 2023-01-26 18:22:15.865503-0600 MessagingExampleSwift[1179:196687] 10.4.0 - [FirebaseAnalytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r) 2023-01-26 18:22:15.877790-0600 MessagingExampleSwift[1179:196762] 10.4.0 - [FirebaseMessaging][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_messagingto ensure proper integration.2023-01-26 18:22:15.895393-0600 MessagingExampleSwift[1179:196158] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect;  (2) find the code that added the unwanted constraint or constraints and fix it. ( "<_UILayoutSupportConstraint:0x281154320 _UILayoutGuide:0x100a2ae60.height == 20 (active)>", "<_UILayoutSupportConstraint:0x2811542d0 _UILayoutGuide:0x100a2ae60.bottom == UIView:0x100a288a0.bottom (active)>", "<NSLayoutConstraint:0x28117bd90 UIButton:0x100a28e20'Log Token'.height == 44 (active)>", "<NSLayoutConstraint:0x281154050 UIButton:0x100a28e20'Log Token'.centerY == UIView:0x100a288a0.centerY (active)>", "<NSLayoutConstraint:0x2811540f0 V:[UIButton:0x100a28e20'Log Token']-(103.5)-[UILabel:0x100a07df0] (active)>", "<NSLayoutConstraint:0x281154190 V:[UILabel:0x100a07df0]-(194)-[_UILayoutGuide:0x100a2ae60] (active)>", "<NSLayoutConstraint:0x281154730 'UIView-Encapsulated-Layout-Height' UIView:0x100a288a0.height == 615 (active)>")Will attempt to recover by breaking constraint <NSLayoutConstraint:0x28117bd90 UIButton:0x100a28e20'Log Token'.height == 44 (active)>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.2023-01-26 18:22:15.895684-0600 MessagingExampleSwift[1179:196158] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect;  (2) find the code that added the unwanted constraint or constraints and fix it. ( "<_UILayoutSupportConstraint:0x281154320 _UILayoutGuide:0x100a2ae60.height == 20 (active)>", "<_UILayoutSupportConstraint:0x2811542d0 _UILayoutGuide:0x100a2ae60.bottom == UIView:0x100a288a0.bottom (active)>", "<NSLayoutConstraint:0x281154050 UIButton:0x100a28e20'Log Token'.centerY == UIView:0x100a288a0.centerY (active)>", "<NSLayoutConstraint:0x2811540f0 V:[UIButton:0x100a28e20'Log Token']-(103.5)-[UILabel:0x100a07df0] (active)>", "<NSLayoutConstraint:0x281154190 V:[UILabel:0x100a07df0]-(194)-[_UILayoutGuide:0x100a2ae60] (active)>", "<NSLayoutConstraint:0x281154730 'UIView-Encapsulated-Layout-Height' UIView:0x100a288a0.height == 615 (active)>")Will attempt to recover by breaking constraint <NSLayoutConstraint:0x281154190 V:[UILabel:0x100a07df0]-(194)-[_UILayoutGuide:0x100a2ae60] (active)>Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.2023-01-26 18:22:17.915505-0600 MessagingExampleSwift[1179:196681] Metal API Validation Enabled2023-01-26 18:22:18.404600-0600 MessagingExampleSwift[1179:196682] 10.4.0 - [FirebaseAnalytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement2023-01-26 18:22:18.427214-0600 MessagingExampleSwift[1179:196763] 10.4.0 - [FirebaseMessaging][I-FCM002022] APNS device token not set before retrieving FCM Token for Sender ID '804880211453'.Be sure to re-retrieve the FCM token once the APNS device token is set.2023-01-26 18:22:18.427296-0600 MessagingExampleSwift[1179:196763] 10.4.0 - [FirebaseMessaging][I-FCM002022] Declining request for FCM Token since no APNS Token specified

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
PODS: - FirebaseAnalytics (10.4.0): - FirebaseAnalytics/AdIdSupport (= 10.4.0) - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - FirebaseAnalytics/AdIdSupport (10.4.0): - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleAppMeasurement (= 10.4.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - FirebaseCore (10.4.0): - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Logger (~> 7.8) - FirebaseCoreInternal (10.4.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" - FirebaseInstallations (10.4.0): - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - PromisesObjC (~> 2.1) - FirebaseMessaging (10.4.0): - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleDataTransport (~> 9.2) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/Reachability (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleAppMeasurement (10.4.0): - GoogleAppMeasurement/AdIdSupport (= 10.4.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleAppMeasurement/AdIdSupport (10.4.0): - GoogleAppMeasurement/WithoutAdIdSupport (= 10.4.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleAppMeasurement/WithoutAdIdSupport (10.4.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/MethodSwizzler (~> 7.8) - GoogleUtilities/Network (~> 7.8) - "GoogleUtilities/NSData+zlib (~> 7.8)" - nanopb (< 2.30910.0, >= 2.30908.0) - GoogleDataTransport (9.2.1): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - GoogleUtilities/AppDelegateSwizzler (7.11.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - GoogleUtilities/Environment (7.11.0): - PromisesObjC (< 3.0, >= 1.2) - GoogleUtilities/Logger (7.11.0): - GoogleUtilities/Environment - GoogleUtilities/MethodSwizzler (7.11.0): - GoogleUtilities/Logger - GoogleUtilities/Network (7.11.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - "GoogleUtilities/NSData+zlib (7.11.0)" - GoogleUtilities/Reachability (7.11.0): - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (7.11.0): - GoogleUtilities/Logger - nanopb (2.30909.0): - nanopb/decode (= 2.30909.0) - nanopb/encode (= 2.30909.0) - nanopb/decode (2.30909.0) - nanopb/encode (2.30909.0) - PromisesObjC (2.1.1)DEPENDENCIES: - FirebaseAnalytics - FirebaseMessaging (~> 10.4.0)SPEC REPOS: trunk: - FirebaseAnalytics - FirebaseCore - FirebaseCoreInternal - FirebaseInstallations - FirebaseMessaging - GoogleAppMeasurement - GoogleDataTransport - GoogleUtilities - nanopb - PromisesObjCSPEC CHECKSUMS: FirebaseAnalytics: 0be84b933ca3222bca03e8cccf020ad9b1c3c6ffFirebaseCore: b8697a177690b69b0dbce9d612b69b893be70469FirebaseCoreInternal: e301297f4c15a17489e48ed722d733b1578e0c02FirebaseInstallations: 36b38c733fd37e50857e5e8d74138648f466f18cFirebaseMessaging: e7304d6ce5f83d9139f0a61383a2302beb99b111GoogleAppMeasurement: 173fa22ce7d62c29332568e853b39b2525a0e584GoogleDataTransport: ea169759df570f4e37bdee1623ec32a7e64e67c4GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06fnanopb: b552cce312b6c8484180ef47159bc0f65a1f0431PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cbPODFILE CHECKSUM: 5034a851dd30eae26a4f25ae4a6dcccc1274f47fCOCOAPODS: 1.11.3

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close