Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS 6 Map problems with MKUserTrackingModeFollowWithHeading
    primarykey
    data
    text
    <p>I'm trying to solve two problems with <code>MKUserTrackingModeFollowWithHeading</code> in iOS 6: </p> <ul> <li><p><code>MKUserTrackingModeFollowWithHeading</code> works briefly, but it's jittery and returns to <code>MKUserTrackingModeFollow</code> almost immediately, especially at high zoom levels. </p></li> <li><p>The app occasionally crashes when repeatedly changing the <code>MKUserTrackingMode</code>: I get <code>EXC_BAD_ACCESS</code> on the main thread, without further information. This is hard to reproduce, but it has happened repeatedly. </p></li> </ul> <p>Any thoughts on what might be causing this? It feels like a bug, but Apple's own "Maps" app doesn't exhibit this behavior. </p> <p>In order to isolate the problems, I've created a Single View Application with an <code>MKMapView</code> and a <code>UIToolbar</code> (set up in a .xib), to which I'm adding a <code>MKUserTrackingBarButtonItem</code>. The <code>UIViewController</code> acts as a <code>&lt;MKMapViewDelegate&gt;</code>. Here's the complete implementation code: </p> <pre><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 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload