IOS在应用程序终止时获取位置更新,而不使用significantChange [英] IOS Getting location updates when app terminated without using significantChange

查看:201
本文介绍了IOS在应用程序终止时获取位置更新,而不使用significantChange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I apologise for the redundancy of this topic, but in spite all the given answers, I can't identify the possibility of getting accuracyBest location updates when the app is terminated. I don't want to use monitoringSignificantChange, I want the best possible accuracy; I won't submit the app on the AppStore, so Apple restrictions are not a problem either.

我已经完成了这些:

- 位置更新,即使应用程序被终止/终止

- iOS更新位置,即使应用已终止

- 使用位置更新应用程序终止时

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

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

and many more, but it is not clear whereas it's possible or not. I currently have my project, everything works great with significantChange but I now need better accuracy.

如果在应用程序被杀死时获得最佳准确位置更新,有人可以直接告诉我可能吗?

Could somebody tell me straight forward if getting best accuracy location update when app is killed is possible please ?

无限地谢谢你,

推荐答案

看着在Apple文档的内容之下,您显然有两种选择,可以使用重要的位置更改来从后台唤醒应用程序。 我已粗略标记了可以用来重新启动应用的服务(如果已终止)。

Looking at the below content from the Apple doc, you clearly have 2 alternatives against using significant location changes to wake a app from the background. I have marked in bold the services you can use to relaunch the app if it has been terminated.


使用背景中的位置服务大多数位置服务都是
,当你的应用程序在前台时使用,但有些也可以在后台运行
。在某些情况下,位置事件甚至可以导致
您的应用重新启动以处理事件。要在后台运行大多数位置
服务,您需要在Xcode项目的Capabilities选项卡中启用位置更新
后台模式。对于启动您的应用的
服务,您需要向用户请求(并获得)
始终授权。

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.

标准位置服务正常运行,而应用程序是
在前台运行。当您的应用在后台时,此
服务仅在为应用启用位置更新后台模式
时才会发送事件。此服务不会重新启动已终止
的iOS应用。

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.

重要位置更改服务通常会发送
当应用程序在前台或后台运行时。 对于
终止的iOS应用,此服务重新启动应用以提供
事件。
使用此服务需要来自
用户的始终授权。

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.

区域监控服务通常在
应用程序在前台或后台运行时发送事件。 (您可以在地理区域和信标区域使用此
服务。)对于已终止的
iOS应用,此服务会重新启动应用以提供活动。
使用
此服务需要用户始终授权。

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测距通常会发送事件。当您的应用程序处于后台时,只有在为应用程序和标准位置服务运行
的位置更新后台模式启用时,此服务才会提供
事件。 (如果beacon
region的notifyEntryStateOnDisplay属性为YES,则唤醒设备
会导致应用程序在
背景中为信标设置几秒钟。)此服务不会重新启动具有
背景的iOS应用程序已被终止
;但是,您可以通过使用区域监控服务监控beacon
区域来重新启动。

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.

标题服务通常会在iOS应用程序为
时提供事件在前台跑。当您的应用在后台时,此
服务仅在为应用启用位置更新后台模式
且标准位置服务正在运行时才会发送事件。
此服务不会重新启动已终止的iOS应用。

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.

访问服务正常提供活动,而iOS应用为
在前台运行。当您的应用在后台时,此
服务仅在为应用启用位置更新后台模式
且标准位置服务正在运行时才会发送事件。
对于已终止的iOS应用,此服务会重新启动应用以提供活动。使用此服务需要来自
用户的始终授权。

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.

启用位置更新后台模式可确保app
在后台继续接收位置事件。当
应用程序移至后台时,系统会将location-services
指示符添加到状态栏,以便让用户知道应用程序正在使用
位置服务。系统可能会在任何时候终止应用程序
来收回其内存或其他资源。

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.

同样来自文档,

获取访问地点
在iOS中,访问服务为需要位置的应用提供重要位置更改服务的替代方案
有关用户访问过的有趣地点的信息。
对于
的示例,如果用户在一个位置长时间
的时间内,该服务可能会在用户到达
该位置时产生一个事件,而另一个用户离开该位置。
服务适用于可能已经使用
重要位置更改服务的应用,并希望以更低的功耗方式
这样做。您不会使用此服务来创建导航应用程序或依赖于常规位置更新的
应用程序。

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆