expo: [iOS] One of the `NSLocation*UsageDescription` keys must be present
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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 38 (7 by maintainers)
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.
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.
For other reasons, we continued forward with SDK 42, and have not been able to resolve the issue, and am unsure how to handle this. I keep seeing conflicting information, as some individuals claims you can run background location on Expo Go, while others cannot, and am unsure of how to handle this, as Background location is paramount in the development of our application.
@brentvatne i am still getting the error
I have included all 4 NSLocation*UsageDescriptions into my app.json, any help?
Hi @brentvatne it’s working now thanks 😃