IOS push notification permission status undetermined

i am building a standalone ios app using SDK 32.
notification works fine when run during development in expo client but fails in standalone app installed via apple testflight.
im using exact same code provided in the doc to get permission and device token for push notification
I have fcm setup for android and config file added.
APN key added during IOS build. i have added same key to fcm as well.
apple APP ID has push notification added.

Permissions.getAsync(Permissions.NOTIFICATIONS) return undetermined

2 Likes

Hey @vglobal,

Could you provide a more complete code excerpt? Permissions.getAsync() returns a promise, so you need the await keyword, as it is used in the docs (e.g. - const yourVariableName = await Permissions.getAsync(Permissions.NOTIFICATIONS)).

Other than that, what platform/device are you running the tests on via testflight? Just checking to make sure since simulators can’t receive push notifications.

Thanks!
Charlie

1 Like

I am having the same problem on IOS Standalone Build.

I’m using SDK v31.

The permission is correctly obtained on Expo app but on IOS Testflight build with SDK v31 it returns “undetermined”.

Help please i tried to rebuilt several times but still the same. I also delete all the certificates from my Apple Developers Account and choose to let Expo handle those for me but still is not working. Thanks

1 Like

@vglobal and @perdida_peso,

Additionally, ensure that you are using a Production Push Certificate when pushing to devices that have installed the app through TestFlight.
See- ios - Why push notifications is not working on testflight? - Stack Overflow for more info.

Hope this helps!
Charlie

1 Like

i am sorry I wrote just the method for simplicity, await is used in real code. We’ve figured it out what was wrong with our project, I am writing a separate reply with our solution, thanks for responding, much appreciated.

Our Apple ID didn’t have push notification service enabled at first. we enabled it for a later version. To have push notification enabled for your new builds you need to have

  • Push notification enabled in APP ID (you might need to generate SSL certificates, which can be generated from same screen)

  • Provisioning profile must have push notification listed in services enabled

  • generate a key for APNs

  • use only production cert and provisioning profile

clear current credentials from expo and download and upload certificate, provisioning profile and push key

8 Likes

Totally Agree with @vglobal!

In our case our APP ID had the “Push Notifications Service” disabled, we enabled it (Leave it as Configurable), refresh the Provisioning Profile so it listed the Push Notification Service as enabled and generate a new build. Now the status of the permission is correct and it returns the correct Expo Token :slight_smile:

APP ID Config:

Provisioning Profile:

25%20AM

4 Likes

I made the same changes, now “Push Notifications” appears on “Enabled Services”… but I still cant get the Expo Push Token. Please tell me if i have to download the certificates and pass to expo build:ios.

Thank you

Well … you can try generating the credentials manually, i’ts actually not that complicated.

You need:

  1. Distribution Certificate (.p12 file => https://docs.expo.io/versions/latest/distribution/building-standalone-apps/#if-you-choose-to-build-for-ios) (Remember to put a password on the .p12 file!!)

  2. Push Notifications Key (.p8 file - You can generate it on Apple Developers console, but you can only download it once, at creation time)

  3. Provisioning Profile (.mobileprovision file - You can generate it on Apple Developers console, check for Push Notifications Service Enabled)

Then run expo build:ios --clear-credentials and upload your credentials manually :slight_smile:

5 Likes

Just wanted to say I ran into the same problem, and your solution worked for me, so thanks @perdida_peso!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.