Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 停止位置更新并再次启动后未调用didUpdateToLocation_Iphone_Cllocationmanager - Fatal编程技术网

Iphone 停止位置更新并再次启动后未调用didUpdateToLocation

Iphone 停止位置更新并再次启动后未调用didUpdateToLocation,iphone,cllocationmanager,Iphone,Cllocationmanager,我有一个搜索当前位置的场景。一旦当前位置搜索开始,我使用“startMonitoringSignificantLocationChanges”调用didUpdateToLocation委托,并获得位置值 搜索结束后,我使用“stopMonitoringSignificantLocationChanges”关闭GPS 我的问题是,我可能会在一段时间后进行超现实位置搜索,当搜索完成时,也就是说,在GPS打开但未调用“didUpdateToLocation”后,我再次开始搜索当前位置 我在视图控制器中

我有一个搜索当前位置的场景。一旦当前位置搜索开始,我使用“startMonitoringSignificantLocationChanges”调用didUpdateToLocation委托,并获得位置值

搜索结束后,我使用“stopMonitoringSignificantLocationChanges”关闭GPS

我的问题是,我可能会在一段时间后进行超现实位置搜索,当搜索完成时,也就是说,在GPS打开但未调用“didUpdateToLocation”后,我再次开始搜索当前位置

我在视图控制器中执行所有这些操作

我已初始化位置管理器,并已将所需的精度设置为“KCallocationAccuracyNearesttenmeters”,将距离过滤器设置为“10.0f”

为什么我不能调用“didUpdateToLocation”委托来完成位置更新并再次启动它

请任何人帮助我

期待你们中的任何一个人的积极回应


谢谢。

您应该使用StartupDating位置,而不是StartMonitoring重要位置更改。startMonitoringSignificantLocationChanges仅在位置发生显著更改时调用didUpdateToLocation

if (locationManager == nill)
    locationManager = [[CLLocationManager alloc] init];

locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
locationManager.distanceFilter = 10;

[locationManager startUpdatingLocation];