【问题标题】:Phonegap/Cordova Geolocation IPhonePhonegap/Cordova 地理定位 iPhone
【发布时间】:2012-09-21 10:08:59
【问题描述】:

我在使用用户地理位置的 phonegap 应用程序方面遇到了一些问题。每次在应用中打开页面,我们都会收到以下消息

最好防止应用显示此提示。

我们使用Cordova 1.9,PhoneGap Build,并在config.xml中设置了访问位置的权限:

<feature name="http://api.phonegap.com/1.0/geolocation"/>

我们不能像here 描述的那样对objectiv-c 代码进行深度更改,因为我们使用PhoneGap Build!

我的代码如下所示...

function onDeviceReady() {

    // get position
    if (watchId == null) {
        killWatcher();
        window.setTimeout(function() {
            navigator.geolocation.getCurrentPosition(updateUserPosition, log, {
                enableHighAccuracy: false
            });
            watchId = navigator.geolocation.watchPosition(updateUserPosition, onGPSError, {
                frequency : 5000,
                maximumAge : 30000,
                enableHighAccuracy : true
            });
            localStorage.setItem("watchID", watchId);
        }, 1000);
    }
}

函数监听 ondeviceready 事件。

有人知道如何解决这个问题吗?

谢谢!

【问题讨论】:

    标签: ios cordova geolocation alert


    【解决方案1】:

    好的,这里的问题是 Cordova.js 并未包含在所有页面中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-08
      • 1970-01-01
      相关资源
      最近更新 更多