React Native geolocation fails: the NSLocation usage description is missing from Info.plist
Either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription or NSLocationAlwaysAndWhenInUseUsageDescription key must be present in Info.plist to use geolocationShort answer
iOS will not show the location prompt unless the app's Info.plist has a usage description key such as NSLocationWhenInUseUsageDescription. In a bare project, add the key to Info.plist. In Expo, set it through the expo-location config plugin, then build a new native binary, because these keys cannot change at runtime.
Fix it fast
1Find out which cause you have
Print the keys that the built app really contains. If no NSLocation key is listed, the cause is below.
grep -n "NSLocation" ios/*/Info.plist2Match what you see, then jump to its fix
- 1
The grep above prints nothing for ios/YourApp/Info.plistA bare React Native project has no NSLocation key in Info.plistFix - 2
The project has an app.json and no ios/ folder, or expo-location is not listed under pluginsAn Expo project sets no location text in the config pluginFix - 3
app.json or Info.plist is correct, yet the same error comes backThe text was added but the installed app is an old binaryFix
- 1
What does the error look like?
Either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription or NSLocationAlwaysAndWhenInUseUsageDescription key must be present in Info.plist to use geolocationAuthorization requests fail immediately and silently when the keys are missing
Cause 1 of 3
A bare React Native project has no NSLocation key in Info.plist
1Check
The community geolocation library names three keys: when-in-use, always-and-when-in-use and the older always key. It says that if they are missing, authorization requests fail immediately and silently.
grep -n -A1 "NSLocation" ios/*/Info.plist2Fix
Add NSLocationWhenInUseUsageDescription with a sentence that tells the user why the app needs location. Add the always keys only if the app needs background location.
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location to show nearby places.</string>3Verify
Rebuild the iOS app natively and call the location API again. The permission prompt should appear.
grep -n NSLocation ios/*/Info.plistConfirmed by github.com
Cause 2 of 3
An Expo project sets no location text in the config plugin
1Check
Expo documents the keys as Info.plist values that the expo-location config plugin writes. Check that the plugin is listed in app.json.
grep -n -B1 -A4 "expo-location" app.json2Fix
Add the plugin with your own text. locationWhenInUsePermission fills NSLocationWhenInUseUsageDescription, and locationAlwaysAndWhenInUsePermission fills the always-and-when-in-use key.
{
"expo": {
"plugins": [
["expo-location", {
"locationWhenInUsePermission": "We use your location to show nearby places."
}]
]
}
}3Verify
Create a new native build. For a local project, run prebuild, then build and start the app again.
npx expo prebuildConfirmed by docs.expo.dev
Cause 3 of 3
The text was added but the installed app is an old binary
1Check
Expo states that these properties cannot be set at runtime and need a new app binary. Reloading JavaScript or restarting Metro does not change Info.plist.
grep -n NSLocation ios/*/Info.plist2Fix
Install a new build of the app (development build, local build or EAS build) and remove the old one first. If you use Continuous Native Generation, regenerate ios/ with prebuild. If you do not, edit ios/YourApp/Info.plist by hand.
npx expo prebuild3Verify
Open the new build, trigger the location request, and confirm the system prompt shows your text.
grep -n NSLocation ios/*/Info.plistConfirmed by docs.expo.dev
How do I stop it coming back?
- Write the usage description text when you add any library that reads location, not when a reviewer asks.
- Request only the when-in-use key unless the app really tracks location in the background.
- After any change to Info.plist or app.json plugins, make a new native build instead of reloading.
- Keep the text specific to what the app does with location.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Mobile apps
Running pod on a React Native project fails with can't find gem cocoapods
can't find gem cocoapods (>= 0.a) with executable pod
The pod command exists, but the Ruby that is running it has no CocoaPods gem.
3 causes, each with a fixMobile apps
Axios request works on iOS or in a browser but fails on Android with Network Error
AxiosError: Network Error
A React Native app has no CORS, so on Android a Network Error usually means the request never reached the server.
3 causes, each with a fixMobile apps
Axios returns Network Error in a React Native app on iPhone or the iOS Simulator
error.code is ERR_NETWORK and error.response is undefined
A Network Error means iOS stopped the request before any HTTP answer came back.
3 causes, each with a fixMobile apps
backgroundImage: url(...) does nothing in a React Native view
ImageBackground renders an empty area
In React Native the backgroundImage style draws linear and radial gradients, not pictures, so url(...) is ignored.
3 causes, each with a fixMobile apps
A custom font in React Native falls back to the system font
Unrecognized font family 'MyFont'
React Native does not report a missing font, it just draws the system font.
6 causes, each with a fixMobile apps
fetch fails with TypeError: Network request failed in React Native
Network request failed
Network request failed means the request never got an HTTP response, so there is no status code to read.
3 causes, each with a fix