[iOS] One of the `NSLocation*UsageDescription` keys must be present

See original GitHub issue

Summary

Hi !

When I want to request background permission on iOS through Expo Go with a real device. I receive this error :

[Unhandled promise rejection: Error: One of the `NSLocation*UsageDescription` keys must be present in Info.plist to be able to use geolocation.]

My app.json looks like good to me :

"ios": {
      "supportsTablet": true,
      "infoPlist": {
        "ITSAppUsesNonExemptEncryption": false,
        "UIBackgroundModes": ["location", "fetch"],
        "CFBundleAllowMixedLocalizations": true,
        "NSLocationAlwaysAndWhenInUseUsageDescription": "App requires geolocation to improve the quality of the service",
        "NSLocationAlwaysUsageDescription": "App requires geolocation to improve the quality of the service",
        "NSLocationWhenInUseUsageDescription": "App requires geolocation to improve the quality of the service",
        "NSCameraUsageDescription": "The picture will be used to inform the state of the packages during delivery"
      }
    },

Also, when I try in the simulator, the error is undefined

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

41.0.1

Environment

Expo CLI 4.4.3 environment info: System: OS: macOS 11.2.3 Shell: 5.8 - /bin/zsh Binaries: Node: 14.16.1 - /var/folders/k6/cqlnsz8x0756r83kbyb0s2700000gp/T/fnm-shell-4295205/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.12 - /var/folders/k6/cqlnsz8x0756r83kbyb0s2700000gp/T/fnm-shell-4295205/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 12.4/12D4e - /usr/bin/xcodebuild npmPackages: expo: ~41.0.1 => 41.0.1 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 4.4.3 Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

Here is a snack implementation, https://snack.expo.io/@dckthomas/frisky-ramen In the snack, there is a dialog asking for permission but not when it’s run from a fresh project like this : https://github.com/DCKT/geofence-expo

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:38 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
guhanganesamurthicommented, May 21, 2021

HI @ansaf-kz , after expo start, it works as expected in Expo Go Android but not in iOS as issue states. Expo suggested building a custom Expo Go for iOS to get this working. But that also has been cancelled for expo 41.

In my above post, I just wanted to showcase that it works in standalone builds.

2reactions
bailakahncommented, Apr 29, 2021

Hi i am getting he same issue. I was using expo SDK 40 with requestPermissionsAsync(). I upgraded to SDK 41 and now using requestForegroundPermissionsAsync() and requestBackgroundPermissionsAsync(). For the later i get error [Error: One of the NSLocation*UsageDescription keys must be present in Info.plist to be able to use geolocation.].

All the answers i am seing here are for people who are building their app.

Is there a way to get this working on local with expo Go ?

Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: One of the `NSLocation*UsageDescription` keys must ...
When I want to test my app with Expo Go on iOS I get this error: [Unhandled ...
Read more >
NSLocationAlwaysUsageDescrip...
This key is required if your iOS app uses APIs that access the user's location at all times and deploys to targets earlier...
Read more >
Error: One of the `NSLocation*UsageDescription` keys must ...
Coding example for the question Error: One of the `NSLocation*UsageDescription` keys must be present in Info.plist to be able to use geolocation-React ...
Read more >
14.0.2 - expo-location - npm
Your app can poll for the current location or subscribe to location update events.. Latest version: 15.0.1, last published: 2 months ago.
Read more >
Information Property List Key Reference
Table 2. Keys for APFiles dictionary 86. iOS Keys 89. Table 1 ... Info.plist file, it chooses the key that is most specific...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found