Cordova iOS location message

后端 未结 5 1819
忘了有多久
忘了有多久 2020-12-19 01:37

I use the plugin cordova-plugin-geolocation. My only issue is that the message prompt to allow location looks like this:

/var/container/bundle/applica

5条回答
  •  一向
    一向 (楼主)
    2020-12-19 02:19

    From docs:

    iOS Quirks

    Since iOS 10 it's mandatory to add a NSLocationWhenInUseUsageDescription entry in the info.plist.

    NSLocationWhenInUseUsageDescription describes the reason that the app accesses the user's location. When the system prompts the user to allow access, this string is displayed as part of the dialog box. To add this entry you can pass the variable GEOLOCATION_USAGE_DESCRIPTION on plugin install.

    Example: cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="your usage message"

    If you don't pass the variable, the plugin will add an empty string as value.

    To solve your problem, try:

    Uninstall the plugin:

    cordova plugin remove cordova-plugin-geolocation
    

    Reinstall with:

    cordova plugin add cordova-plugin-geolocation --variable GEOLOCATION_USAGE_DESCRIPTION="my_project would like to use your location"
    

提交回复
热议问题