gpt4 book ai didi

ios - 在iOS上占用GPS资源(使用地理位置类,Adobe AIR)

转载 作者:行者123 更新时间:2023-12-01 17:00:49 24 4
gpt4 key购买 nike

我正在通过Adobe AIR开发iOS应用。

我发现如果在iOS平台上使用Geolocation类,它将占用GPS资源,而其他应用程序则无法使用GPS功能。

有人找到相同的东西吗?

我不确定这是我的错误代码还是Adobe AIR的错误。

以下是我的代码:

    private var geolocation:Geolocation;

private function geolocationGet():void{
geolocation = new Geolocation();
geolocation.setRequestedUpdateInterval(100);
geolocation.addEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);
}

private function geoUpdateHandler(e:GeolocationEvent):void{
geolocation.removeEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);
trace("latitude: "+e.latitude+", longitude: "+e.longitude);
}

最佳答案

这可能是因为您过于频繁地提出请求而拖累了GPS。它甚至可能无法应对第一个响应,因此一切都被阻塞了。将setRequestedUpdateInterval更改为3000,而不是100毫秒,因为它应该起作用。

关于ios - 在iOS上占用GPS资源(使用地理位置类,Adobe AIR),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7155805/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com