gpt4 book ai didi

ios - MKMapView 与 iOS 8 崩溃

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:14:30 25 4
gpt4 key购买 nike

我有一个简单的 View Controller ,里面有一个 MKMapView 对象,定义如下:

类声明:

@interface GeoViewController : UIViewController  <MKMapViewDelegate>

@property (nonatomic, strong) MKMapView* viewMap;

@end

实现:

@implementation GeoViewController

- viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
viewMap = [[MKMapView alloc] init];
MKCoordinateRegion worldRegion = MKCoordinateRegionForMapRect(MKMapRectWorld);
[viewMap setRegion:worldRegion animated:YES];
viewMap.pitchEnabled = YES;
viewMap.showsUserLocation = YES;
viewMap.delegate = self;
[self.view addSubview:viewMap];
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
viewMap.showsUserLocation = NO;
self.viewMap.delegate = nil;
[self.viewMap removeFromSuperview];
}

- (void)resizeForOrientation:(BOOL)isLandscape withFrame:(CGRect)frame {
[super resizeForOrientation:isLandscape withFrame:frame];
const CGRect fullFrame = CGRectMake(0, 0, frame.size.width, frame.size.height);
viewMap.frame = fullFrame;
}

@end

我第一次展示 View Controller 的工作原理。然后我在我的应用程序中导航,如果我回到 GeoViewController,崩溃:

  • 控制台没有消息错误
  • main.m 打开并报告“Thread 1: EXC_BAD_ACCESS”
  • 在调试导航器(左)上,我收到关于线程 1 的错误报告:

    EAGLContext_renderbufferStorageFromDrawable(EAGLContext*, objc_selector*, unsigned int, id)

现在,谷歌搜索了很多,我找不到适合我的工作解决方案:

我也试过 viewDidDisappear,但没办法

 [EAGLContext setCurrentContext:nil];

这一行似乎崩溃了:

 viewMap.frame = fullFrame;

任何建议将不胜感激!

更新

我在测试中的某个时候收到其他错误:

检测到 opengl 线程冲突

最佳答案

我在

中遇到了 EXC_ARM_DA_ALIGN 错误
EAGLContext_renderbufferStorageFromDrawable(EAGLContext*, objc_selector*, unsigned int, id)

同样,当使用 MKMapView 时。

此问题中提到的解决方法:Adding google maps as subview crashes iOS app with exc_bad为我工作。

在我的目标方案中禁用“GPU Frame Capture”功能就成功了。

关于ios - MKMapView 与 iOS 8 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30391642/

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