ICW
ICW

Reputation: 5759

Expo Location Permissions Instantly Denied iOS Simulator

When I do:

import * as Permissions from 'expo-permissions';
import React from 'react';
import {View} from 'react-native';


export default function Screen() {
    Permissions.askAsync(Permissions.LOCATION).then(function(obj) {
        console.log(obj);
    });
    return <View></View>;
};

The promise instantly resolves, and my access is denied without the application having asked me for permission to use location services:

Object {
  "expires": "never",
  "permissions": Object {
    "location": Object {
      "expires": "never",
      "granted": false,
      "ios": Object {
        "scope": "none",
      },
      "status": "denied",
    },
  },
  "status": "denied",
}

But if I run it on my iPhone instead of the simulator, the application actually asks for location permission.

Upvotes: 0

Views: 1048

Answers (1)

Dang Hai Luong
Dang Hai Luong

Reputation: 1356

Probably because the expo/your app has been in the simulator before and the location permission was not granted. The location permission dialog only shows once per app lifetime. Have you tried uninstalling the app?

Upvotes: 1

Related Questions