I am trying to solve two problems with MKUserTrackingModeFollowWithHeading in iOS 6:
MKUserTrackingModeFollowWithHeading does not work for long, but it gets nervous and immediately returns to MKUserTrackingModeFollow , especially at high zoom levels.
The application is periodically reset when MKUserTrackingMode changed many times: I get EXC_BAD_ACCESS in the main thread without additional information. It is difficult to reproduce, but it has happened repeatedly.
Any thoughts on what could be causing this? It feels like a bug, but the Apple Maps app does not exhibit this behavior.
To isolate the problems, I created a Single View application with MKMapView and UIToolbar (configured in .xib), to which I add MKUserTrackingBarButtonItem . UIViewController acts like <MKMapViewDelegate> . Here's the full implementation code:
#import "ViewController.h" @implementation ViewController @synthesize mapView, toolbar; - (void)viewDidLoad { [super viewDidLoad]; // Add MKUserTrackingBarButtonItem to toolbar MKUserTrackingBarButtonItem *trackButton = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.mapView]; [toolbar setItems:[NSArray arrayWithObjects:trackButton, nil] animated:YES]; } - (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated { // Log MKUserTrackingMode change NSString *modeType = (mode == 0) ? @"None" : ((mode == 1) ? @"Follow" : @"FollowWithHeading"); NSLog(@"MKUserTrackingMode changed to: %@", modeType); } @end
source share