firebase / firebase/firebase-ios-sdk

FirebaseMessaging 12.18.0 — FID registration completes without error but FCM backend returns UNREGISTERED

Open
#16,638 6 comments 0 reactions 1 assignee Claimed by @leojaygoogle View on GitHub
api: messaging
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 14h
Merged PRs (30d)
72

Description

### Description

Environment
Firebase iOS SDK: 12.18.0
FirebaseMessaging: 12.18.0
Physical iPhone / Development APNs environment
FirebaseMessagingInstallationIdEnabled = YES
Messaging.messaging().isInstallationIdEnabled == true
Messaging.messaging().isAutoInitEnabled == true

### Reproducing the issue

Problem
After migrating to FID-based Firebase Messaging registration, the application is unable to establish a valid FCM backend registration.
APNs itself is working correctly. A notification sent directly through Apple's Push Notifications Console to the device APNs token is successfully delivered to the application.
Firebase Messaging correctly detects the development APNs environment:
[FirebaseMessaging][I-FCM023013] APNS Environment in profile: development
Firebase Messaging initializes and reports:
[FirebaseMessaging][I-FCM002029] Listening for FID rotation events
However, automatic registration does not produce a usable FID registration.
We then explicitly called Messaging.messaging().register() only after receiving the APNs device token:

### Firebase SDK Version

12.18.0

### Xcode Version

26.6

### Installation Method

Swift Package Manager

### Firebase Product(s)

All

### Targeted Platforms

iOS

### Relevant Log Output

```shell
[FirebaseInstallations][I-FIS002001]
installationWithValidAuthTokenForcingRefresh:0
```

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

func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
Messaging.messaging().apnsToken = deviceToken

Messaging.messaging().register { error in
if let error {
print("FCM REGISTER ERROR:", error)
} else {
print("FCM REGISTER REQUEST COMPLETED")
}
}
}
The registration completion reports no error, but the Messaging delegate initially receives:

NEW REGISTERED FID: nil
FCM REGISTER REQUEST COMPLETED
We then performed a one-time:

Installations.installations().delete(...)

followed by Messaging.messaging().register().
This caused the Messaging delegate to return a non-nil FID and register() again completed without error.
However, sending directly through the FCM HTTP v1 API to that FID produces:

HTTP 404

{
"error": {
"code": 404,
"message": "NotRegistered",
"status": "NOT_FOUND",
"details": [
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "UNREGISTERED"
}
]
}
}

We also tested the previously generated full legacy FCM registration token using the HTTP v1 "token" target. It also returns:
HTTP 404
NotRegistered
UNREGISTERED

Important APNs verification
The same physical device successfully receives a notification sent directly through Apple's Push Notifications Console using its APNs device token.
Therefore:
notification permission is working
APNs device registration is working
the application's Push Notifications entitlement is working
the bundle ID/APNs environment is working
direct APNs delivery to the physical device is working
The failure appears specifically to be that Firebase Messaging is not creating/maintaining the FCM backend registration associated with the FID, despite Messaging.register() completing without an error.

Additional observations
With -FIRDebugEnabled, after register() we see Firebase Installations activity such as:

[FirebaseInstallations][I-FIS002001]
installationWithValidAuthTokenForcingRefresh:0

but no subsequent Messaging registration error is reported.
This appears related to #16429, which was marked fixed for 12.18.0. We are already running 12.18.0, but the resulting state still appears to be an FID that exists locally while FCM considers it UNREGISTERED.
Expected behavior
After Messaging.register() completes successfully and didReceiveRegistration supplies an FID, that FID should be registered with the FCM backend and usable as an HTTP v1 FID target.
Actual behavior
Messaging.register() completes without error, but HTTP v1 immediately reports the supplied FID as:

404 NOT_FOUND
UNREGISTERED

### If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

```yml

Replace this line with the contents of your Podfile.lock!

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.