IOS 6 MKMapView在[EAGLContext setCurrentContext]崩溃

Din*_*yav 6 exc-bad-access opengl-es mkmapview ios6

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

当我们切换到另一个具有基于opengl的图表解决方案(shinobi)的视图时,通过使用故事板.在使用地图返回视图时,在地图上触摸移动它之前没有问题.当我们尝试移动地图时,它会在[EAGLContext setCurrentContext]中使用exc_bad_access异常崩溃

有任何想法吗?

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

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 ...
Run Code Online (Sandbox Code Playgroud)

小智 7

我为Shinobi工作,我们一直在研究这个问题 - 部分原因在于Apple的地图代码保留了我们的GL-Context.作为临时解决方法,您可以创建ShinobiChart的子类,并在图表的dealloc方法中清除GL上下文,如下所示:

- (void) dealloc {
    [super dealloc];

    [EAGLContext setCurrentContext:nil]; // must be after dealloc
}
Run Code Online (Sandbox Code Playgroud)

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

#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
Run Code Online (Sandbox Code Playgroud)

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

  • 我有这个完全相同的问题,但上述解决方案并没有解决它:( (2认同)