question

Stesvis-5434 avatar image
0 Votes"
Stesvis-5434 asked Stesvis-5434 commented

FirebasePushNotification plugin iOS - token not refreshing

I am using the FirebasePushNotification plugin, and in iOS i have always issues.
In debug mode it works ok, but in release it never fires the OnTokenRefresh event (i know because i set messages boxes and I also print it on the screen).

What could be the cause of this? I am so frustrated, I've tried everything, just not working in Release mode.

Thank you!

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Stesvis-5434 avatar image
1 Vote"
Stesvis-5434 answered mbouma commented

So I finally got it to work!

I upgraded the plugin to the latest version, and also installed these in the iOS project manually:

  • Xamarin.Firebase.iOS.CloudMessaging

  • Xamarin.Firebase.iOS.Core

  • Xamarin.Firebase.iOS.InstanceID

Then, I reuploaded the APNs certificate in Firebase. The Auth APN Key file is recommended, however it only started to work when I chose the other option and uploaded the APN certificate.

Thanks for the help.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Just installing the Xamarin.Firebase.iOS.CloudMessaging fixed it for me

0 Votes 0 ·
ColeXia-MSFT avatar image
0 Votes"
ColeXia-MSFT answered Stesvis-5434 commented

Hello,

Welcome to Microsoft Q&A!

It's a known issue and has been reported here : https://github.com/CrossGeeks/FirebasePushNotificationPlugin/issues/361 .

Workaround : downgrade the plugin to v3.1.6 also downgrade its dependencies .


Thank you.


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

That was since september? hmmmm....doesn't look like a priority to get it fixed...
Thanks for the link and the workaround, I'll try it.

0 Votes 0 ·
Stesvis-5434 avatar image
0 Votes"
Stesvis-5434 answered Stesvis-5434 commented

@ColeXia-MSFT I downgraded the plugin and i was able to get the token.
However, the iOS app does not receive them.

I sent a notification thru Postman and it completed successfully:

{
    "multicast_id": 4267051523857827808,
    "success": 1,
    "failure": 0,
    "canonical_ids": 0,
    "results": [
        {
            "message_id": "0:1612045674651933%9166abc09166abc0"
        }
    ]
}


But the app did not fire the received notification event.
On the other hand, in the output window I got this log:

[Firebase/Messaging][I-FCM002019] FIRMessaging received data-message, but FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented

But i did implement that method as per instructions:

// To receive notifications in foregroung on iOS 9 and below.
        // To receive notifications in background in any iOS version
        public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
        {
            // If you are receiving a notification message while your app is in the background,
            // this callback will not be fired 'till the user taps on the notification launching the application.

            // If you disable method swizzling, you'll need to call this method. 
            // This lets FCM track message delivery and analytics, which is performed
            // automatically with method swizzling enabled.
            FirebasePushNotificationManager.DidReceiveMessage(userInfo);
            // Do your magic to handle the notification data
            System.Console.WriteLine(userInfo);

            completionHandler(UIBackgroundFetchResult.NewData);
        }


I really do not understand what to do to make this work...

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Stesvis-5434 , did you ever find a solution for this, for Im experiencing the same thing now ?

0 Votes 0 ·

No I got tired of Xamarin problems, plus with MAUI coming there were too many changes to make so we decided to redo the app in React Native.

0 Votes 0 ·