简体   繁体   中英

Ionic Geolocation, No Permission on iOS

I've been trying to get the geolocation package to work for the past 3 hours and decided to ask for some help, maybe you can see something I can't.

I've followed the directions, and can not get the app to get permission on any iOS device for the location service.

config.xml

https://gist.github.com/keoir/90ea3b75fefed70495409fd5692ac5c0

Package.json

https://gist.github.com/keoir/285c4c04671f70c2473783052936af0d

app.component.ts

https://gist.github.com/keoir/2d09d7cc6956b507a47a59701f0e1aa2

@dhanesekar's solution was erased every time I ran ionic cordova build ios . To solve this, I added the following in config.xml:

<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
   <string>Get Position</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
   <string>Get position</string>
</edit-config>

And after : ionic cordova platform remove ios && ionic cordova platform add ios

add NSLocationWhenInUseUsageDescription to the .plist. Open /platforms/ios/{project}/{project}-Info.plist and add the following:

<key>NSLocationWhenInUseUsageDescription</key>
<string>[App Name] would like to access your location when running and displayed.</string>

我遇到了同样的问题,我遵循了这个git doc并成功了。

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