IOS 6 Issues with MKUserTrackingModeFollowWithHeading

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 
+4
source share
2 answers

This is a bug in MapKit. This can also be seen on Apple Maps using MapKit, such as the My Friends app. Please note that the Apple Maps application does not use MapKit (at least not the same version), so this error is not affected.

I also see sporadic EXC_BAD_ACCESS crashes in MapKit. In fact, MapKit-related crashes account for the vast majority of my app crashes. :(

+4
source

I also noticed that MKUserTrackingModeFollowWithHeading does not work for long and it immediately switches to MKUserTrackingModeFollow, especially at high zoom levels.

I tried

 - (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated { if (mapView.userTrackingMode != MKUserTrackingModeFollowWithHeading) { [mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading]; } } 

but this creates a forever loop, because immediately after switching to MKUserTrackingModeFollowWithHeading, something returns back to MKUserTrackingModeFollow. This is very annoying because I don’t know what continues to change the tracking mode to MKUserTrackingModeFollow.

Sorry my answer was not helpful, but I posted here to confirm the problem.

+3
source

All Articles