热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

位置权限警报使用Phonegap显示两次-LocationpermissionalertshowsuptwiceusingPhonegap

Ivebeenstrugglingwiththisforthepasttwodays.Ihavelookedatvariousresponsesbutnoneha

I've been struggling with this for the past two days. I have looked at various responses but none have solved my problem. I am using Phonegap Build to publish an iPhone app. One on of the features is to get the user's current location. Before the map loads I get two alerts, the first one is a normal alert asking me if I want to grant my current location. However the second alert show a directory path where the file is located also asking if I want to grant the app permission to my location (see image below) I tried the following suggested solution here Location permission alert on iPhone with PhoneGap without any luck.

过去两天我一直在努力解决这个问题。我看过各种各样的回答,但没有一个能解决我的问题。我正在使用Phonegap Build来发布iPhone应用程序。其中一个功能是获取用户的当前位置。在地图加载之前,我收到两个警报,第一个是正常警报,询问我是否要授予我当前位置。然而,第二个警报显示文件所在的目录路径,也询问我是否要将应用程序权限授予我的位置(请参见下图)我在此尝试了以下建议的解决方案:带有PhoneGap的iPhone上的位置权限警报没有任何运气。

This is what I have in my config.xml file

这就是我在config.xml文件中的内容






    



    
    



   
      needs your location
   

I call the init function from the body tag

我从body标签调用init函数

     function init(){
        document.addEventListener("deviceready",onDeviceReady,false);
     }
     function onDeviceReady(){
        navigator.geolocation.getCurrentPosition(success, fail);    
     }

enter image description here I also tried these solutions but none work

我也试过这些解决方案,但都没有用

How to prevent double prompt for geolocation in Phonegap app?

如何防止在Phonegap应用程序中双重提示地理位置?

Location permission alert on iPhone with Cordova

使用Cordova在iPhone上的位置许可警报

What could I be doing wrong? Are there any examples or tutorials that anyone can recommend?

我能做错什么?是否有任何人可以推荐的示例或教程?

1 个解决方案

#1


0  

I finally figured it out, I added the following lines and the second alert no longer shows up

我终于明白了,我添加了以下几行,第二个警报不再出现




推荐阅读
author-avatar
大美妞庄严典雅__
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有