我想了很多事情阻止我的應用程序的位置更新,但似乎沒有工作...位置後的LocationManager =零仍然監測和stopUpdatingLocation稱爲
我做什麼(職位的方面:StopUpdatingLocation method not working for iOS5):
// Initialise my locationManager and start monitoring :
locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
// .. Some code to use the coordinates that locationManager gives me.
// To stop monitoring :
locationManager = nil;
你要知道我放在[locationManager stopUpdatingLocation];
的方法:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
所以位置更新只有1次(順便說一句告訴我,如果是個好主意…)。
我也試圖把[locationManager stopUpdatingLocation];
只是locationManager = nil;
之前在主代碼,但藍點,讓我我的位置還在動我在這兩種情況下地圖...
我也可以設定打印locationManager
定時器對象在控制檯,它給了我(null)
與此同時藍點仍然在我的iPhone 5上移動,所以我不明白...
或者也許點仍然移動,因爲另一件事,但不是因爲locationManager更新?
我當然錯過了一些東西,但我沒有得到什麼:/。
感謝您的想法和幫助。
//初始化我的locationManager並開始監控: locationManager = [[CLLocationManager alloc] init]; [locationManager startUpdatingLocation]; // ..使用locationManager給我的座標的一些代碼。 //停止監測: locationManager = nil; 這一切都在一個方法?那會是錯誤的。 – tzl 2013-05-06 15:15:39
是的,它是..?怎麼了 ? :/ – Lucien 2013-05-06 16:47:36
,因爲位置管理器已分配零。您將無法在回調locationManager中訪問它:didUpdateLocations:如果您在回調中放置了[locationManager stopUpdatingLocation],它將不起作用。 – tzl 2013-05-07 02:32:22