iOS 6使用MKUserTrackingModeFollowWithHeading映射问题 [英] iOS 6 Map problems with MKUserTrackingModeFollowWithHeading

查看:446
本文介绍了iOS 6使用MKUserTrackingModeFollowWithHeading映射问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用iOS 6中的 MKUserTrackingModeFollowWithHeading 解决两个问题:

I'm trying to solve two problems with MKUserTrackingModeFollowWithHeading in iOS 6:


  • MKUserTrackingModeFollowWithHeading 短暂工作,但它很紧张,几乎立即返回 MKUserTrackingModeFollow ,特别是在高缩放级别。

  • MKUserTrackingModeFollowWithHeading works briefly, but it's jittery and returns to MKUserTrackingModeFollow almost immediately, especially at high zoom levels.

当反复更改 MKUserTrackingMode 时,应用程序偶尔会崩溃:我得到 EXC_BAD_ACCESS 在主线程上,没有进一步的信息。这很难复制,但它反复发生。

The app occasionally crashes when repeatedly changing the MKUserTrackingMode: I get EXC_BAD_ACCESS on the main thread, without further information. This is hard to reproduce, but it has happened repeatedly.

有关可能导致此问题的任何想法?感觉就像一个错误,但Apple自己的地图应用程序没有表现出这种行为。

Any thoughts on what might be causing this? It feels like a bug, but Apple's own "Maps" app doesn't exhibit this behavior.

为了解决问题,我创建了一个单视图应用程序,其中包含 MKMapView UIToolbar (在.xib中设置),我正在添加 MKUserTrackingBarButtonItem UIViewController 充当< MKMapViewDelegate> 。这是完整的实现代码:

In order to isolate the problems, I've created a Single View Application with an MKMapView and a UIToolbar (set up in a .xib), to which I'm adding a MKUserTrackingBarButtonItem. The UIViewController acts as a <MKMapViewDelegate>. Here's the complete 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


推荐答案

这是MapKit中的错误。也可以使用MapKit在Apple Maps中观察,例如Find My Friends应用程序。请注意,Apple Maps应用程序未使用MapKit(至少不是同一版本),因此它不受此错误的影响。

This is a bug in MapKit. It can be observed also in Apple Maps using MapKit such as the Find My Friends app. Note that the Apple Maps app is not using MapKit (at least not the same version) thus it's not affected by this bug.

我也看到零星的 EXC_BAD_ACCESS 在MapKit中崩溃。事实上,MapKit相关的崩溃占我应用崩溃的绝大部分。 :(

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

这篇关于iOS 6使用MKUserTrackingModeFollowWithHeading映射问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆