2015-12-11 39 views
0

硬件: iPhone 6S 16GB 的iOS 9.1的iOS 9位置管理不回原來的位置

我試圖更新位置管理器應用程序的iOS從6.1到iOS 9.1。

LM的設置如下:

locationManager = [ [ CLLocationManager alloc ] init ] ; 

self.locationManager.delegate = self; 

self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters ; 

[ self.locationManager requestWhenInUseAuthorization ] ; 

[ self.locationManager startUpdatingLocation ] ; 

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations 
{ 

    CLLocation *newLocation = [locations lastObject]; 

    NSLog(@「locations.count = %d」, locations.count) ; 

} 

該應用的設備上運行,並更新位置(經緯度和長),但 locations.count總是等於1。因此,我不能讓以前的位置來計算行駛距離或速度。

+0

你能添加更多的信息,我不能當你移動什麼是你的問題 – satheesh

回答

0

感謝您的回覆。

IOS 9不使用:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Delegate must respond to locationManager:didUpdateLocations:' 

新的代表是:

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations 
{ 
// some code. 
} 

的位置數組包含列表

-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ 
    //Code based on your requirements 
} 

IOS 9與此錯誤消息響應以前的位置。 (當位置管理器在後臺運行時,它需要節約能源。)數組中的最後一項是當前位置。倒數第二個項目是之前的位置。

我的問題是委託只返回最後一個數組項。目前的位置。不是以前的位置。再次

感謝, SXB

+0

是你的位置更新?你使用什麼精度? –