startMonitoringSignificantLocationChanges的示例 [英] Example for startMonitoringSignificantLocationChanges

查看:101
本文介绍了startMonitoringSignificantLocationChanges的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iPhone编程的新手.我正在寻找有关如何在CoreLocation管理器中使用startMonitoringSignificantLocationChanges方法的示例或演示.

I am new to iPhone programming. I am looking for an example or a demo on how to use startMonitoringSignificantLocationChanges method with the CoreLocation Manager.

我对文档感到困惑,因为我不确定是否调用与调用startUpdatingLocation相同的委托方法. (即调用了委托locationManager: (CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation: (CLLocation *)oldLocation)

I am confused by the documentation because, I am not sure if the same delegate method is called as in the case of invoking startUpdatingLocation. (i.e. the delegate locationManager: (CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation: (CLLocation *)oldLocation is called)

在此方面的任何帮助将不胜感激.另外,我正在通过CLLocationManager的子类在模拟器上对其进行测试.当在iPhone Simulator上运行时,此子类提供位置服务的模拟.有没有更好的方法来测试这一点.

Any help on this would be appreciated. Also, I am testing it on the simulator by subclassing of CLLocationManager. This subclass provides a simulation of location services when running on the iPhone Simulator. Is there a better way to test this.

推荐答案

我已经对重大更改API进行了一些测试.我在GitHub上发布了示例项目,使您可以定期进行重要的位置更新.

I have done a bit of testing with the significant change API. I posted a sample project on GitHub that lets you play with regular and significant location updates.

此问题可能也有一些启发当您为重大变更事件而醒来时会发生什么.

This question might also shed some light on what happens when you get woken up for a significant change event.

更新

您应该注意的另一件事是,在4.1版的CoreLocation中有一个错误..基本上,如果您的应用程序在后台运行,则当核心位置尝试唤醒您时,它将崩溃.它已在4.2中修复.

Another thing you should be aware of, there is a bug in CoreLocation in 4.1. Basically if your app is in the background, then it will crash when core location tries to wake you up. It is fixed in 4.2.

这篇关于startMonitoringSignificantLocationChanges的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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