简体   繁体   中英

Geolocation api, where is the info.plist file if I create the app with expo?

I'm struggling to get the geolocation info, latitude and longitude. I tried these two react-native-geolocation-service , @react-native-community/geolocation , but immediately after the import I get error:

Error: @react-native-community/geolocation: NativeModules.RNCGeolocation is null. To fix this issue try these steps: • Run react-native link @react-native-community/geolocation in the project root. • Rebuild and re-run the app. • If you are using CocoaPods on iOS, run pod install in the ios directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.

In the docs is written that I have to add the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in Info.plist, but there is no info.plist because the app was mede with expo (If I not wrong). So, how can I solve this problem? Also I'm using the ios simulator, not the android studio.

I think you should try this one for expo projects, geolocation that you used was for react native cli

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM