Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

React Native geolocation fails: the NSLocation usage description is missing from Info.plist

ErrorEither NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription or NSLocationAlwaysAndWhenInUseUsageDescription key must be present in Info.plist to use geolocation

Short 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.

  • Applies to React Native 0.7x-0.8x, Expo SDK 5x, iOS 17-26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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.plist
  2. 2Match what you see, then jump to its fix

    1. 1The grep above prints nothing for ios/YourApp/Info.plistA bare React Native project has no NSLocation key in Info.plistFix
    2. 2The 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. 3app.json or Info.plist is correct, yet the same error comes backThe text was added but the installed app is an old binaryFix

What does the error look like?

  • Either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription or NSLocationAlwaysAndWhenInUseUsageDescription key must be present in Info.plist to use geolocation
  • Authorization 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.plist

2Fix

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.plist

Confirmed by github.com

Did this fix it?

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.json

2Fix

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 prebuild

Confirmed by docs.expo.dev

Did this fix it?

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.plist

2Fix

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 prebuild

3Verify

Open the new build, trigger the location request, and confirm the system prompt shows your text.

grep -n NSLocation ios/*/Info.plist

Confirmed by docs.expo.dev

Did this fix it?

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:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.