iOS 6 自动暂停不起作用

时间:2023-03-21
本文介绍了iOS 6 自动暂停不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我已经按照Session 303 - 从定位服务保持跟踪"WWDC 2012 中的 AutoPause 示例

I've follow the example of AutoPause from "Session 303 - Staying on track from Location Services" WWDC 2012

在示例中,您可以看到 AutoPause 是如何启用的,并且有两个方法被调用:

In the example you can see how AutoPause is enabled and there two methods which are called:

-(void) locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager
-(void) locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager

我做了同样的例子,但这些方法从来没有被调用过.谁试过了?

I've done the same example but these methods aren't never called. Who have tried the same?

推荐答案

我现在正在尝试,以下是我的观察:

I'm experimenting with that right now and here are my observations:

在 iPhone 4 上,这根本不起作用.即使您将 pausesLocationUpdatesAutomatically 设置为 YES,它也会将 pausesLocationUpdatesAutomatically 设置为 NO(0).没有警告,这是什么 API 设计反模式!

On iPhone 4, that is not working at all. Even if you set pausesLocationUpdatesAutomatically to YES it keeps pausesLocationUpdatesAutomatically as NO(0). No warnings, what kind of API design anti-pattern is this!

在 iPhone 5 上 pausesLocationUpdatesAutomatically 默认为 YES (1).并调用 locationManagerDidPauseLocationUpdates.我在调用 locationManagerDidResumeLocationUpdates 时运气不好.我也很困惑,如果 GPS 关闭,这将如何调用?一旦用户到达下一个网络单元,它会被调用吗?即使那不是我的经验,也从来没有被调用过.

On iPhone 5 pausesLocationUpdatesAutomatically is YES (1) by default. And locationManagerDidPauseLocationUpdates is called. I'm having a bad luck having the locationManagerDidResumeLocationUpdates called. I'm also puzzled how this is going to be called if GPS is off? Will it be called once user reaches the next network cell? Even that is not my experience, it is not ever called.

到目前为止,在我看来,这是 iOS6 中一致性最差的变化之一.对于所有场景,我可能只使用 pausesLocationUpdatesAutomatically = NO,并希望在 iOS6 的所有型号上都能正常工作.

So far, looks to me as one of the least consistent changes in iOS6. I might be going with just pausesLocationUpdatesAutomatically = NO for all scenarios and will hope that works ok on all models with iOS6.

[更新 - 2013 年 3 月 4 日].我查看了 Apple 关于 iOS6 中位置更改的演示文稿,他们建议在收到区域更改事件后使用区域更改监控来取消暂停".虽然这不适合我的场景,因为用户可能会去/跑步/开车一两公里,直到发生此类事件.

[Update - 4-Mar-2013]. I looked through the Apple's presentation for location changes in iOS6 and they suggest to use the region changes monitoring to "un-pause" once you get region changes event. Though this is not suitable for my scenarios as user might go/run/drive for a kilometer or two until such an event happens.

这篇关于iOS 6 自动暂停不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:在 Swift 中从 Radius 中的 GeoFire 检索密钥 下一篇:将从应用程序获取的地理位置传递给 UIWebView

相关文章