Antonio MG
Antonio MG

Reputation: 20410

startMonitoringSignificantLocationChanges not working in iOS5

This is how I init my location manager:

    self.locationManager = [[[CLLocationManager alloc] init] autorelease];
    self.locationManager.delegate = self;
    [self.locationManager startMonitoringSignificantLocationChanges];

In iOS6, right after creating it, the delegate is called with my current location:

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

However, if the device Im testing is iOS5, this delegate is never called.

What could be the reason?

Upvotes: 3

Views: 1175

Answers (1)

tkanzakic
tkanzakic

Reputation: 5499

The problem is that the method

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

is new to iOS6, in iOS5 you have to use:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

Upvotes: 3

Related Questions