草庐IT

startUpdatingLocation

全部标签

ios - CLLocation 管理器 startUpdatingLocation 未启动

我一直在关注这个教程http://www.devfright.com/ios-6-core-location-tutorial/将位置服务添加到我的ios应用程序。我在我的TestFileViewController.h文件中导入了Corelocation,如下所示:#import#import#import@interfaceTestFileViewController:UIViewController@property(nonatomic,strong)CLLocationManager*locationManager;@end然后在我添加的testFileViewControll

iOS 模拟器、CLLocationManager、startUpdatingLocation 和 locationManager :didUpdateLocations

我正在使用iOSSDK7.1。在我的ViewController的viewDidLoad方法中,我创建了一个CLLocationManager对象并将它发送给startUpdatingLocation方法。在iOS模拟器中,我可以更改位置,然后调用locationManager:didUpdateLocations。但是,似乎并没有在CLLocationManager对象接收到startUpdatindgLocation方法后立即调用locationManager:didUpdateLocations。在CLLocationManger中startUpdatingLocation的文档

ios - 何时调用 [clLocationManager stopUpdatingLocation]

为了在我的应用程序中节省电量,我决定在应用程序处于事件状态时混合使用startUpdatingLocation并在应用程序处于后台时进入startMonitoringSignificantLocationChanges模式。当应用程序进入后台时,我基本上会执行以下操作:-(void)applicationDidEnterBackground:(UIApplication*)application{[myLocationManagerstartMonitoringSignificantLocationChanges];}当应用程序返回前台时,我执行以下操作:-(void)applicat

swift - 为什么 LocationManager 会多次调用 startUpdatingLocation?

为什么位置管理器不止一次调用startUpdatingLocation?有时调用一次,有时调用三次。我不知道为什么;也许你可以帮助我。我有来自GitHub的代码。importUIKitimportCoreLocationclassViewController:UIViewController,CLLocationManagerDelegate{letlocationManager=CLLocationManager()overridefuncviewDidLoad(){super.viewDidLoad()self.locationManager.delegate=selfself.l

ios - CLLocationManager 的 startMonitoringSignificantLocationChanges() 和 startUpdatingLocation() 方法有什么区别?

我正在使用CLLocationManager类。我想定期获取位置更新。我在didUpdateLocations方法中找到了两种获取位置的方法,即startUpdatingLocation()和startMonitoringSignificantLocationChanges()。如果我还必须在前台模式下跟踪位置更新,那么我应该使用哪种方法? 最佳答案 两者之间最重要的区别是:startMonitoringSignificantLocationChanges:itdoesnotrelyonthevalueinthedistanceFi

ios - startMonitoringSignificantLocationChanges 和 startUpdatingLocation 如何相互影响?

如果我在startMonitoringSignificantLocationChanges运行时调用startUpdatingLocation会发生什么情况?significantLocationChange监控是否停止?如果我然后stopUpdatingLocationsignificantLocationChange监控会继续还是重新启动?我找不到任何文档说明这两种监视位置的方式之间的相互作用。 最佳答案 我认为接受的答案并没有真正回答所提出的问题。我做了一些测试,如果你愿意,你可以同时使用它们,它们不会相互抵消。为什么有人要同

ios - startMonitoringSignificantLocationChanges 和 startUpdatingLocation 如何相互影响?

如果我在startMonitoringSignificantLocationChanges运行时调用startUpdatingLocation会发生什么情况?significantLocationChange监控是否停止?如果我然后stopUpdatingLocationsignificantLocationChange监控会继续还是重新启动?我找不到任何文档说明这两种监视位置的方式之间的相互作用。 最佳答案 我认为接受的答案并没有真正回答所提出的问题。我做了一些测试,如果你愿意,你可以同时使用它们,它们不会相互抵消。为什么有人要同

iphone - StartUpdatingLocation 与重大更改位置服务

我有关于显着变化位置服务的问题。Apple文档说“无论您使用标准定位服务还是重大更改定位服务来获取定位事件,您接收这些事件的方式都是相同的。”但是在“显着变化的位置服务”的情况下,我无法获得任何回调我得到了“标准位置服务”的情况请让我知道是否有人有任何意见? 最佳答案 startUpdatingLocation在第一次调用时更新位置,然后在距离过滤器值超过时更新位置。但是startMonitoringSignificantLocationChanges位置发生重大变化时。请查看CLLocationManager了解详情。startU

objective-c - CLLocationManager startUpdatingLocation 与 startMonitoringSignificantLocationChanges

我正在开发一个网络应用程序,该应用程序使用户能够登录该应用程序,但前提是他们位于某些指定区域。我在应用程序的开头调用了locationManagerstartUpdatingLocation来获取用户的位置并启用/禁用登录。一旦用户登录,我调用[locationManagerstopUpdatingLocation];[locationManagerstartMonitoringSignificantLocationChanges];并在更新的位置在区域之外时注销用户。使用这两种方法会有任何冲突吗?(我正在模拟器上测试代码,因此位置始终相同)。注意:我没有使用didEnterRegio

iphone - CLLocationManager startUpdatingLocation 不工作

所以现在我至少得到了以下代码的回调......-(void)viewDidLoad{[superviewDidLoad];mapView=[[MKMapViewalloc]initWithFrame:self.view.frame];//mapView.showsUserLocation=TRUE;mapView.delegate=self;[self.viewinsertSubview:mapViewatIndex:0];NSLog(@"locationServicesEnabled:%@",[CLLocationManagerlocationServicesEnabled]?@"Y
12