IOS push notification permission status undetermined


#1

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


Unable to get expo push token in app from TestFlight
#2

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


#3

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


#4

@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- https://stackoverflow.com/questions/24044298/why-push-notifications-is-not-working-on-testflight for more info.

Hope this helps!
Charlie


#5

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.


#6

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


#7

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


#8

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


#9

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:


#10

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