CLLocationManager startUpdatingLocation not working in application:didFinishLaunchingWithOptions:

327 views Asked by At

I'm using the CLLocationManager startUpdatingLocation in the AppDelegate's method application:didFinishLaunchingWithOptions: The delegate method are never fired.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...

    [self performSelectorOnMainThread:@selector(startUpdatingLocation) withObject:nil waitUntilDone:NO];

//    [self startUpdatingLocation];

    return YES;
}

-(void)startUpdatingLocation
{
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];
}

I've tried both, using main thread and just calling my method, but none of them is working.

I've implemented all these method, but none of them is triggered:

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error

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

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

Solution:

https://devforums.apple.com/message/1073496#1073496
0

There are 0 answers