End of Chapter 5 foundLocation never fires



I’m stuck at the end of chapter 5 right before the challenges.
My application compiles and runs, but after setting the title of the BNRMapPoint via the keyboard, it looks like the foundLocation method never fires.
The activity indicator goes on and on, nothing happens. Location gets updated in the console.

I’ve set a breakpoint at

- (void)findLocation
    [locationManager startUpdatingLocation];     <<< BREAKPOINT
    [activityIndicator startAnimating];
    [locationTitleField setHidden:YES];

and went through the code line by line, it enters textFieldShouldReturn,

- (BOOL)textFieldShouldReturn:(UITextField *)textField
    [self findLocation];
    [textField resignFirstResponder];
    return YES;

but after running through all it’s statements, it seems to jump into some kind of assembly code and from there on the program just stays like that, Indicator running.



I was having the same issue just now, I’d check two things.

[code]- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
NSLog(@"%@", newLocation);

NSTimeInterval t = [[newLocation timestamp] timeIntervalSinceNow];

if(t < -180)
    return;//Cached data, no need to use

[self foundLocation:newLocation]; //Won't hit foundLocation without this.

}[/code]If you forget that last line you won’t hit. Also check your auto complete on the [locationManager startUpdatingLocation]; I had auto-completed startUpdatingHeader.


Thank You!
I had a typo in my code:

    NSTimeInterval t = [[newLocation timestamp] timeIntervalSinceNow];
    if (t<180){       // <<<< should be -180

I found it when I compared your code with mine line by line.


This one was driving me crazy! I think I went back through my code a hundred times but couldn’t find the problem. Amazing what one missing character can do. :wink:


Thanks, this was driving me crazy too! So easy to miss that little “-”…