To the best of my knowedge I do not believe I am doing anything wrong however I am getting:
2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.352 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Here is my code
- (IBAction) btnGetCurrentLocation{
[SVProgressHUD showWithStatus:@"Getting current location..."];
locationManager = [[CLLocationManager alloc] init];
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.delegate = self;
[locationManager startUpdatingLocation];
[SVProgressHUD dismiss];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
[locationManager stopUpdatingLocation];
CLLocationCoordinate2D coordinate = newLocation.coordinate;
LocationMapViewController *locationMapViewController = [[LocationMapViewController alloc] initWithNibName:@"LocationMapViewController_iPhone" bundle:nil];
locationMapViewController.title=@"Your Title";
locationMapViewController.centerOfMap = &(coordinate);
[self.navigationController pushViewController:locationMapViewController animated:YES];
}
I googled it however most places talk about putting animation:NO however then I do not see the map on next screen.
You are pushing a new controller every time that CLLocationManager notify a change of location from the same controller. That results in a nested navigation. Trying to hold a reference to LocationMapViewController in that controller at first time that you are being notified, and later check it to notify it:
if (self.locationController == null){
LocationMapViewController *locationMapViewController = [[LocationMapViewController alloc] initWithNibName:@"LocationMapViewController_iPhone" bundle:nil];
locationMapViewController.title=@"Your Title";
locationMapViewController.centerOfMap = &(coordinate);
[self.navigationController pushViewController:locationMapViewController animated:YES];
}else{
[self.locationController locationDidChangeTo: &(coordinate)];
}
Another alternative is creating the CLLocationManager in the LocationMapViewController...