Permissions for notifications are failing in iOS 12

#1

Hi guys,
today i update my phone to public beta test of iOS 12 and the permissions for notifications always return undetermined.

This works as expect on iOS 11 my code (im using SDK 28), my code did not change and the permissions were accepted correctly.

The method I use is the same one that is published in your documents:

https://docs.expo.io/versions/latest/guides/push-notifications#1-save-the-users-expo-push-token

Here the example code (look the comments within the code):

async function registerForPushNotificationsAsync() {
  const { status: existingStatus } = await Permissions.getAsync(
    Permissions.NOTIFICATIONS
  );

  // existingStatus returns "undetermined", EVEN IF THE PERMISSIONS HAVE BEEN ACCEPTED

  let finalStatus = existingStatus;
  if (existingStatus !== 'granted') {
    const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
    
    // status returns "undetermined", EVEN IF THE PERMISSIONS HAVE BEEN ACCEPTED
    
    finalStatus = status;
  }
  if (finalStatus !== 'granted') {
    return;
  }
  // ...
}

Thanks !!!

#2

We aren’t testing on beta versions of iOS yet – but if you want to dive into it, you could build Expo from source (either https://github.com/expo/expo or make a detached app) and debug from Xcode.

closed #3

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