AdamEssenmacher / GoogleApisForiOSComponents

A community-supported fork of the abandoned Xamarin.iOS.* binding libraries from Microsoft
MIT License
63 stars 13 forks source link

[iOS] Must restart the app at least once to receive push notifications #37

Closed Lee31416 closed 2 months ago

Lee31416 commented 2 months ago

In our project, only on ios we need to restart the app at least once to receive push notifications. After restarting the app once everything works fine. We request permissions and got logs that say they are granted and then we register for push notifications with the apns which also logs success. Then we register the firebase token with our backend that sends the push notifications also returning success. I tried using xamarin.firebase instead of this package and we couldn't receive any push and the fcm was null on first launch. That made me think that both packages for slim bindings on ios might be at fault. We are currently blocked on this since no workaround was found.

miroatp commented 2 months ago

I'm not sure whether it's of any help for you but I remember the requirement to start the app without debugger to receive the notifications. It's mentioned here as one of the iOS Specifics.

Do you have the same issue in the test production build downloaded from Testflight?

Lee31416 commented 2 months ago

Well ios debugging on us stopped working on that project a while ago for some unknown reason so we always tested from a QA build on testflight and it produces the same issue

Lee31416 commented 2 months ago

The issue was that firebase doesn't map the apns token correctly or it does but too late for our purpose, the fix was to manually set the apns token in the app delegate and wait with a task completion source that the delegate releases after it's done so we can proceed with fetching the fcm token