0
+(void) vStartUpdatingLocation
{
    while (false);
    AssertNonMainThread
    [[NSOperationQueue mainQueue]addOperationWithBlock:^{
        CLLocationHandler * singleton = [CLLocationHandler singleton];
        CLLocationManager * locationManager = singleton.locationManager;
        NSAssert(locationManager.delegate==singleton,@"They are meant for each other"); //Assertion here
        [locationManager startUpdatingLocation]; //update location
        PO(singleton.locationManager);
        PO(singleton.locationManager.delegate);
        PO(singleton); //verify that locationManager.delegate == singleton
        while(false);
    }];
}
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    AssertMainThread;//break point here never called
    PO(self.locationManager);
    PO(manager);
    while(false);
    [self finishUpdating];
    [self updateCurrentPlaceCache:newLocation];
}
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
    [self finishUpdating]; //no love here too
}

I put most info on the comment.

I have verified that locationManager.delegate is indeed the singleton object of type CLLocationHandler

Yet

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

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

is not called. It used to work.

Septiadi Agus
  • 1,775
  • 3
  • 17
  • 26

1 Answers1

0

You need to setup your location manager using performSelectorOnMainThread. It will not work if setup on a background thread. Most likely because your run loop is not active on the background thread. See Why is my CLLocationmanager delegate not getting called?

Community
  • 1
  • 1
zimmryan
  • 1,099
  • 10
  • 19