iOS 6 AutoPause doesn't work

我与影子孤独终老i 提交于 2019-12-19 04:19:08

问题


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

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?


回答1:


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

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!

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.

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.

[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.




回答2:


I had the same problem and found you have to set the property pausesLocationUpdatesAutomatically to YES



来源:https://stackoverflow.com/questions/12920911/ios-6-autopause-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!