我有一個非常簡單的應用程序示例,初始化和更新用戶的位置..在設備上它成功地拋出另一個回調位置每秒左右但設備(iPhone運行iOS7)調用該方法一次,然後神祕地停止...iOS7核心位置不更新
//Setup Location Manager in ViewDidLoad
locationManager = [[CLLocationManager alloc] init];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager setDelegate:self];
[locationManager startUpdatingLocation];
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSLog(@"location services not turned on");
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"loactions %@", locations);
}
-(void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSLog(@"new location %f, and old %f", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
}
在iOS6這個應用程序工作完美並不斷更新設備的位置...自iOS7以來有什麼改變?
didUpdateLocations方法是否觸發? – karthika
它的觸發,但只有一次... –
你在這個方法中調用stopUpdatingLocation? – karthika