Testing getting push notification token on iOS

I was able to succesfully test getting push notifications on Android. I opened up Expo client, I opened my app, and then just did:

const perm = await Permissions.getAsync(Permissions.NOTIFICATIONS);
console.log('perm:', perm);
if (perm.status === 'grant') {
    console.log(await Notifications.getExpoPushTokenAsync());
}

I had already dropped in google-services.json and called the expo push:android:upload --api-key command.

This succesfully got me a token on Android. However on iOS whenever I try to do this I always get undetermined:

{
  "expires": "never",
  "permissions": Object {
    "notifications": Object {
      "allowsAlert": false,
      "allowsBadge": false,
      "allowsSound": false,
      "expires": "never",
      "status": "undetermined",
    },
  },
  "status": "undetermined",
}

Is it possible to test getting token on iOS device? I am running my app through the expo client.

Hey @noitidart, what SDK version are you using?

Thanks @adamjnav but I figured out the problem. Oh my gosh such a subtle difference between Permissions.getAsync and askAsync . My solution was to use askAsync. That took forever! lol

2 Likes

Glad you got it sorted out!

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