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

FCM failed to Fetching the current registration token on iOS 18.1.1 #14203

Open
dongwk2024 opened this issue Dec 3, 2024 · 3 comments
Open

Comments

@dongwk2024
Copy link

Description

When I upgraded my iPhone to iOS 18.1.1, running the Xcode debugging application to try and obtain the token failed,The code is as follows:
Messaging.messaging().token { token, error in if let error = error { print("Error fetching FCM registration token: \(error)") } else if let token = token { print("FCM registration token: \(token)") Application.shared.sendPushToken.onNext(token) } }
Log message:
Error fetching FCM registration token: Error Domain=com.google.fcm Code=505 "No APNS token specified before fetching FCM Token" UserInfo={NSLocalizedFailureReason=No APNS token specified before fetching FCM Token}

My implementation process is roughly as follows:
The didFinishLaunchingWithOptions in Appdelegate initializes firebase (FirebaseApp. configuration())
Then it called (application.registerForRemoteNotifications()) again.

When App entered the viewDidLoad of the homepage viewController, I made a permission request and attempted to obtain the FCMtoken to upload to my application server. At this point, the above problem occurred.

The code for this section is as follows:
截屏2024-12-03 15 53 28

Other information:
I confirm that my code has not been modified. Regarding Firebase, I tried three different versions 10.24.0, 11.4.0, and 11.5.0, and the results were the same.
I have read the official document https://firebase.google.com/docs/cloud-messaging/ios/client My app did not manually register the APNS device token and instead used Method swizzing in Firebase Cloud Messaging
Regarding other logs on FCM:
截屏2024-12-03 16 04 16

This problem has been bothering me for a long time. I hope someone can provide help. Thanks.

Reproducing the issue

No response

Firebase SDK Version

11.5.0

Xcode Version

16.1

Installation Method

CocoaPods

Firebase Product(s)

Messaging

Targeted Platforms

iOS, All

Relevant Log Output

No response

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
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@rizafran
Copy link
Contributor

rizafran commented Dec 4, 2024

Hi @dongwk2024, this error seems related to #10679 (comment) in which there was a change implemented starting v10.4.0. With this, an APNs token must be provided to the SDK before retrieving an FCM token during startup, otherwise, an error will be returned as part of the completion in which you have encountered. We are declining vending an FCM token until an APNS token is provided.

I also found this related post that would possibly resolve the issue.

@google-oss-bot
Copy link

Hey @dongwk2024. 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants