Trying to get permission to send push notifications fails

#1

When I try to get permission to send push notifications with apple I get

“Error: The device was unable to register for remote notifications with Apple”

This is my code

  const { status: existingStatus } = await Permissions.getAsync(
    Permissions.NOTIFICATIONS
  );
  let finalStatus = existingStatus;

  // only ask if permissions have not already been determined, because
  // iOS won't necessarily prompt the user a second time.
  if (existingStatus !== 'granted') {
    // Android remote notification permissions are granted during the app
    // install, so this will only ask on iOS
    const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
    finalStatus = status;
  }

I got it from here: https://docs.expo.io/versions/latest/guides/push-notifications.html#push-notifications

I’m trying on an iPhone 8 simulator
Any ideas?

#2

Push notifications do not work on iOS simulator (this is an Apple restriction). Try testing on a real device instead.

1 Like
closed #3

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