Error :- APNS device token not set before retrieving FCM Token for Sender ID '836092823410'. 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.

Am trying to fetch FCM key from firebase but getting fcm key nil & error i mention above

Google Plist File

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

	<key>CLIENT_ID</key>

	<string>836092823410-d76r5bkjrusfmgo6rskqo81l4mk7vmp4.apps.googleusercontent.com</string>

	<key>REVERSED_CLIENT_ID</key>

	<string>com.googleusercontent.apps.836092823410-d76r5bkjrusfmgo6rskqo81l4mk7vmp4</string>

	<key>API_KEY</key>

	<string>AIzaSyDpP1n_NRqj9c_Mq-pA2PlRez7AnVM5buw</string>

	<key>GCM_SENDER_ID</key>

	<string>836092823410</string>

	<key>PLIST_VERSION</key>

	<string>1</string>

	<key>BUNDLE_ID</key>

	<string>com.iai.tracker</string>

	<key>PROJECT_ID</key>

	<string>crucial-audio-334611</string>

	<key>STORAGE_BUCKET</key>

	<string>crucial-audio-334611.appspot.com</string>

	<key>IS_ADS_ENABLED</key>

	<false/>

	<key>IS_ANALYTICS_ENABLED</key>

	<false/>

	<key>IS_APPINVITE_ENABLED</key>

	<true/>

	<key>IS_GCM_ENABLED</key>

	<true/>

	<key>IS_SIGNIN_ENABLED</key>

	<true/>

	<key>GOOGLE_APP_ID</key>

	<string>1:836092823410:ios:0312dc35c45b23b9e37feb</string>

</dict>

</plist>

I have the same problem and I've been looking for a solution for several days. Have you been able to solve the problem? Gracias, Rafa

Did you add Capabilities: BackgroundModes and PushNotifications?

In my case I'm testing fcm token to firebase with when user sign ins I'm trying to get token to save it on my firestore. So here is my AuthManager

func configureAuthStateChanges() {
        authStateHandle = auth.addStateDidChangeListener { auth, user in
            if (user != nil) {
                self.isSigned = true
                Messaging.messaging().token(){token,error in
                    if let fcmToken = token{
                        FirestorageManager.shared.saveTokenToFirestore(token: fcmToken)
                    }
                    if let error = error{
                        print("error ->", error.localizedDescription)
                    }
                }
            }else {
                self.isSigned = false
            }
            print("Auth changed: \(user != nil)")
            self.updateState(user: user)
        }
    }

When user sign in then I get this error: error -> İşlem tamamlanamadı. No APNS token specified before fetching FCM Token

So my solution was in my CustomAppDelegate I add this function and I test it even with empty body I was able to save it on firestore when user sign in Here is function which I added on CustomAppDelegate:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    }
Error :- APNS device token not set before retrieving FCM Token for Sender ID '836092823410'. 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.
 
 
Q