Reputation: 182
Why the custom location permission message for my iOS Expo React Native app is not showing app? I've tried adding the NSLocationWhenInUseUsageDescription
key to my app.json file, but my custom message isn't showing up when the user is prompted for location access.
my app.json file
{
"expo": {
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.aaa.bbb",
"infoPlist": {
"NSLocationAlwaysAndWhenInUseUsageDescription": "Allow my app to use your location to do this and that....."
}
},
}
}
And this is how I request the permission
useEffect(() => {
setIsLoading(true);
(async () => {
let { status } = await Location.requestForegroundPermissionsAsync();
if (status !== "granted") {
setErrorMsg("Permission to access location was denied");
return;
}
await getCurrentLocationAndUpdateState();
setIsLoading(false);
})();
}, []);
What happening is that the default message is being shown instead of my custom message after building the app and installing it via TestFlight.
Upvotes: 2
Views: 1452
Reputation: 182
My problem turned out to be related to me mixing between the method that gets the permission and the property to be used in the app.json
Changing the property in app.json:expo:ios:infoPlist to
NSLocationWhenInUseUsageDescription
solved the issue for me
Upvotes: 2