Flutter / FCM notifications not arriving on Codemagic iOS build

664

Solution 1

In case anyone is having the same problem. I solved this simply by not using Codemagic for iOS deployment. I followed this guide instead: https://flutter.dev/docs/deployment/ios and deployed the iOS build on Apple's TestFlight.

The push notifications worked great on iOS after installing the app from there.

Solution 2

I would try to check the provisioning profile that is being used by Codemagic during the build. If you already tried to use Automatic code signing on Codemagic, and added FCM later on, then you might have to delete the provisioning profile already created by Codemagic to force Codemagic to create a new one with Push Notifications enabled (once they have been enabled in xcode capabilities). In any case you can check the generated profile on Apple Developer Portal, and check whether the push notifications are enabled for the generated profile.

Share:
664
John
Author by

John

Updated on December 27, 2022

Comments

  • John
    John over 1 year

    I'm trying to build a Flutter app for both Android and iOS. I've been implementing push notifications using Firestore Cloud Messaging (FCM) and it works for both Android and iOS when I'm testing on a simulator (Android) or on a connected physical device (iOS).

    However, when I build the app for the client to test (using Codemagic), the push notifications are not working on iOS (it does on Android). If it works on my development environment but not on Codemagic, that means everything is configured correctly except for Codemagic's build, right??

    This is how I'm configuring it

    I don't think there's an additional configuration to be done on Codemagic besides connecting the apple developer account. But if I had done a mistake connecting the account, then the team wouldn't show up when I'm building the app I suppose.

    Also, when I try sending a push notification via Postman using the FCM token generated by the iphone, it returns "NotRegistered".

    So what am I doing wrong?

    Please, any help would be greatly appreciated.

    Thanks.

  • John
    John about 3 years
    Thank you for answering. I'm giving it a development build. I also set the profile to be on development so I don't think I need a production certificate for this, unless I do?
  • Litehouse
    Litehouse about 3 years
    There are many things to check. Has the iOS user given permission to receive push notifications? Give the Apple Notification Documentation a review. It will give you ideas for things to check.
  • Litehouse
    Litehouse about 3 years
    Here's another link that may help Adding push notifications to iOS flutter apps.
  • John
    John about 3 years
    The reason why I didn't give much info is because the notifications are working on my local environment (when I run flutter on my physical phone). So I know FCM is connected to the APNs properly. I just can't figure why is it not working with the Codemagic build. But thanks for your help anyway!
  • John
    John about 3 years
    Yeap I did check the profile and the certificate generated by Codemagic and they were properly configured with Push Notifications. I set Codemagic after setting FCM and testing it on a local environment (and succeeding), so it should have worked I guess. Anyhow, I already solved this problem by using Apple TestFlight... If you ask me, the problem must be within Codemagic and not my configurations. But thanks anyway!