startMonitoringSignificantLocationchanges не работает в iOS5
Вот как я инит мой менеджер местоположения:
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self;
[self.locationManager startMonitoringSignificantLocationChanges];
В iOS6, сразу после его создания, вызывается делегат с моим текущим местоположением:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
Однако, если устройство Im testing является iOS5, этот делегат никогда не вызывается.
В чем может быть причина?
1 ответ:
Проблема в том, что метод
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locationsЯвляется новым для iOS6, в iOS5 вы должны использовать:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
Comments