gpt4 book ai didi

MKUserTrackingModeFollowWithHeading 的 iOS 6 map 问题

转载 作者:可可西里 更新时间:2023-11-01 05:22:58 24 4
gpt4 key购买 nike

我试图用 MKUserTrackingModeFollowWithHeading 解决两个问题在 iOS 6 中:

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

  • 重复更改 MKUserTrackingMode 时,应用偶尔会崩溃:我得到EXC_BAD_ACCESS在主线程上,没有更多信息。这很难重现,但它已经反复发生。

有什么可能导致这种情况的想法吗?这感觉像是一个错误,但 Apple 自己的“ map ”应用程序并没有表现出这种行为。

为了隔离问题,我创建了一个带有 MKMapView 的单 View 应用程序和一个 UIToolbar (在 .xib 中设置),我要向其中添加 MKUserTrackingBarButtonItem . UIViewController充当<MKMapViewDelegate> .完整的实现代码如下:

#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

最佳答案

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

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

关于MKUserTrackingModeFollowWithHeading 的 iOS 6 map 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15664092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com