首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IOS 6 MKMapView在[EAGLContext setCurrentContext]上崩溃

IOS 6 MKMapView在[EAGLContext setCurrentContext]上崩溃
EN

Stack Overflow用户
提问于 2012-09-26 21:44:20
回答 2查看 3.8K关注 0票数 6

我们正在开发一个从带注释的地图视图开始的iPad应用程序。

当我们切换到另一个具有基于opengl的图表解决方案(shinobi)的视图时,使用故事板。在返回带有地图的视图时,在触摸地图以移动它之前没有任何问题。当我们尝试移动地图时,它在EAGLContext setCurrentContext发生exc_bad_access异常而崩溃

有什么想法吗?

以下是崩溃日志的一部分:

代码语言:javascript
复制
OS Version:      iOS 6.0 (10A403)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000c
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   OpenGLES                        0x39974b12 +[EAGLContext setCurrentContext:] + 74
1   VectorKit                       0x32c64f0c -[VGLGPU setPaused:] + 120
2   VectorKit                       0x32c54db8 -[VKMainLoop updateLinkState] + 492
3   VectorKit                       0x32c54950 -[VKScreenCanvas _updateDisplayStatus:] + 104
4   VectorKit                       0x32ccea9a -[VKScreenCanvas setGesturing:] + 254
5   MapKit                          0x34defc3c -[MKMapView _willStartUserInteraction] + 48
6   MapKit                          0x34de891a -[MKMapGestureController beginGesturing] + 50
7   MapKit                          0x34de8c6c -[MKMapGestureController handlePan:] + 252
8   UIKit                           0x379ead2c _UIGestureRecognizerSendActions + 124
9   UIKit                           0x379b23d8 -[UIGestureRecognizer _updateGestureWithEvent:] + 388
10  UIKit                           0x37b9f474 ...
EN

回答 2

Stack Overflow用户

发布于 2012-09-28 22:09:18

我在Shinobi工作,我们一直在调查这个问题--这在一定程度上是因为苹果的地图代码保留了我们的GL上下文。作为临时解决办法,您可以创建ShinobiChart的子类,并在图表的dealloc方法中将GL上下文置零,如下所示:

代码语言:javascript
复制
- (void) dealloc {
    [super dealloc];

    [EAGLContext setCurrentContext:nil]; // must be after dealloc
}

或者如果你使用的是ARC (因为不允许发送dealloc ):

代码语言:javascript
复制
#import <ShinobiCharts/SChartCanvas.h>

@interface ShinobiChartGl : ShinobiChart
@end

@implementation ShinobiChartGl

- (void) dealloc
{
    [self.canvas.glView removeFromSuperview];

    self.canvas.glView = nil; // force glView dealloc

    [EAGLContext setCurrentContext:nil];
}

@end

希望这会有帮助,但请直接联系我们-我们将在下一个版本中有一个完整的修复。

票数 7
EN

Stack Overflow用户

发布于 2016-06-09 19:35:46

对于那些甚至在dealloc上尝试过[EAGLContext setCurrentContext:nil];的人,可以试试这个

代码语言:javascript
复制
dispatch_async(dispatch_get_main_queue(), ^{
        [EAGLContext setCurrentContext:nil];
    });

应该在主线程上设置EAGLContext。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12603161

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档