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

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

问题描述

对于这个主题的冗余,我深表歉意,但尽管给出了所有答案,但我无法确定在应用程序终止时获得准确最佳位置更新的可能性.我不想使用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

还有更多,但不清楚是否可能.我目前有我的项目,在显着变化下一切都很好,但我现在需要更高的准确性.

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 文档中的内容,您显然有 2 种替代方法可以防止使用重大位置更改从后台唤醒应用程序.我已用粗体标出了可用于在应用已终止时重新启动应用的服务.

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.

标准位置服务在应用程序运行时正常传递事件在前台运行.当您的应用程序在后台时,这服务仅在 location-updates 后台模式下传递事件为应用程序启用.此服务不会重新启动 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.

当应用在前景.当您的应用程序在后台时,此服务会提供仅当启用了位置更新后台模式时的事件该应用程序和标准位置服务正在运行.(如果信标region 的 notifyEntryStateOnDisplay 属性为 YES,唤醒设备导致应用程序在背景.)此服务不会重新启动已被终止;但是,您可以通过监视信标重新启动使用区域监控服务的区域.

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 应用程序运行时正常传递事件在前台运行.当您的应用程序在后台时,这服务仅在 location-updates 后台模式下传递事件为应用程序启用并且标准位置服务正在运行.此服务不会重新启动已终止的 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 应用程序运行时正常传递事件在前台运行.当您的应用程序在后台时,这服务仅在 location-updates 后台模式下传递事件为应用程序启用并且标准位置服务正在运行.对于已终止的 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.

启用位置更新后台模式可确保应用在后台继续接收位置事件.当...的时候应用移动到后台,系统添加位置服务状态栏的指示器,让用户知道应用正在使用位置服务.系统仍可能随时终止应用程序回收其内存或其他资源.

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在应用程序终止而不使用显着更改时获取位置更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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