gpt4 book ai didi

ios - xcode - 如何在没有 CoreLocation 的情况下找到你的当前位置

转载 作者:行者123 更新时间:2023-11-28 18:58:25 24 4
gpt4 key购买 nike

我使用 google maps sdk 开发了一个基于位置的应用程序。如何在没有定位服务的情况下获取当前位置(即定位服务不允许)。我想使用蜂窝数据或 wifi 网络获取当前位置

最佳答案

要使用 wifi 或蜂窝网络获取位置,您必须使用 CoreLocation 并获得用户的许可才能获取他们的位置。

根据 Apple Docs :

For the services you use, configure any properties associated with that service accurately. Core Location manages power aggressively by turning off hardware when it is not needed. For example, setting the desired accuracy for location events to one kilometer gives the location manager the flexibility to turn off GPS hardware and rely solely on the WiFi or cell radios, which can lead to significant power savings.

因此,CoreLocation 会根据您对应用程序所需的准确性来决定从何处获取位置。但您仍然需要许可。

如果您只需要国家/地区左右,Dan 在他的回答中建议的基于 IP 的方法可能足以满足您的需求。

关于ios - xcode - 如何在没有 CoreLocation 的情况下找到你的当前位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29142488/

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