-
Notifications
You must be signed in to change notification settings - Fork 83
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
iOS FCM token is NotRegistered after deleting and reinstalling APP #160
Comments
Exactly, the same problem here! waiting for solution |
Same problem here 😢 |
Anyone got the solution? |
@sagun-gautam A workaround for me was create and endpoint in our backend that validates the push token by sending a data-only push notification and verifying the status code !== 404, then it returns back to the app. If is an invalid token, app calls the function FCM.refreshToken(), it generates a new token (this token may be invalid too, but it works in most cases). It occurs always in the app opening, so the token is always verified. Its not a 100% solution, but it helped a lot. Still waiting for a definitive solution. |
The same problem( |
@knurlann @sagun-gautam can you guys paste here your AppDelegate.swift? |
Hi there, so I upgraded to capacitor 6 and changed code according to this guide and it’s started working fine for me: https://capacitorjs.com/docs/guides/push-notifications-firebase update podfile:
update AppDelegate.swift : @UIApplicationMain var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { |
@sagun-gautam that's totally make sense, I just figured out yesterday that the code in my AppDelegate was:
so I changed it to the same as you pasted there and it started to work fine 🙏🏼 |
Describe the bug
The token generated by
FCM.getToken()
after deleting and installing the app from store returns shows 'UnRegistered' in FCM Rest API response.To Reproduce
Steps to reproduce the behavior:
Expected behavior
FCM token should be valid, I can see the FCM token is stored is valid & changed from last token.
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Additional context
Some time the token generated after reinstalling the app is same in iOS
The text was updated successfully, but these errors were encountered: