gpt4 book ai didi

IOS 在应用程序终止而不使用 significantChange 时获取位置更新

转载 作者:技术小花猫 更新时间:2023-10-29 11:01:35 24 4
gpt4 key购买 nike

对于该主题的冗余,我深表歉意,但尽管给出了所有答案,但我无法确定应用程序终止时获取 accuracyBest 位置更新的可能性。我不想使用 monitoringSignificantChange,我想要最好的准确性;我不会在 AppStore 上提交应用程序,因此 Apple 限制也不是问题。

我经历过这些:

- Location update even when app is killed/terminated

- iOS update location even when app is terminated

- Working with location updates when app is terminated

- http://mobileoop.com/getting-location-updates-for-ios-7-and-8-when-the-app-is-killedterminatedsuspended

还有更多,但尚不清楚是否可能。我目前有我的项目,一切都适用于 significantChange,但我现在需要更高的准确性。

有人可以直接告诉我是否可以在应用程序被杀死时获得最准确的位置更新吗?

无限感谢,

最佳答案

查看 Apple 文档中的以下内容,您显然有 2 个替代方案可以避免使用重大位置更改从后台唤醒应用程序。 我已经用粗体标记了您可以用来重新启动应用程序(如果应用程序已终止)的服务。

Using Location Services in the Background Most location services are meant to be used while your app is in the foreground but some can also run in the background. In some cases, location events can even cause your app to be relaunched to process an event. To run most location services in the background, you need to enable the location updates background mode in the Capabilities tab of your Xcode project. For services that launch your app, you need to request (and be granted) “Always” authorization from the user.

The standard location service delivers events normally while an app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app. This service does not relaunch iOS apps that have been terminated.

The significant location change service delivers events normally while an app is running in the foreground or background. For a terminated iOS app, this service relaunches the app to deliver events. Use of this service requires “Always” authorization from the user.

The region monitoring service delivers events normally while an app is running in the foreground or background. (You can use this service for both geographic and beacon regions.) For a terminated iOS app, this service relaunches the app to deliver events. Use of this service requires “Always” authorization from the user.

Beacon ranging delivers events normally while an app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app and the standard location service is running. (If the beacon region’s notifyEntryStateOnDisplay property is YES, waking the device causes the app to range for beacons for a few seconds in the background.) This service does not relaunch iOS apps that have been terminated; however, you can be relaunched by monitoring beacon regions using the region monitoring service.

The heading service delivers events normally while an iOS app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app and the standard location service is running. This service does not relaunch iOS apps that have been terminated.

The visit service delivers events normally while an iOS app is running in the foreground. When your app is in the background, this service delivers events only when the location-updates background mode is enabled for the app and the standard location service is running. For a terminated iOS app, this service relaunches the app to deliver events. Use of this service requires “Always” authorization from the user.

Enabling the location-updates background mode ensures that an app continues to receive location events while in the background. When the app moves to the background, the system adds the location-services indicator to the status bar to let the user know that an app is using location services. The system may still terminate the app at any time to reclaim its memory or other resources.

Also from the doc,

Getting the Visited Locations In iOS, the visits service provides an alternative to the significant location change service for apps that need location information about interesting places that the user visited. For example, if the user is in one location for an extended period of time, the service might generate an event when the user arrives at that location and another when the user leaves that location. The service is intended for apps that might already be using the significant location change service and want an even lower power way to do so. You would not use this service to create navigation apps or apps that rely on regular location updates.

文档链接:

https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/doc/uid/TP40007125-CH3-SW73

关于IOS 在应用程序终止而不使用 significantChange 时获取位置更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37450524/

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