2012-09-26 105 views
6

我們正在開發一個從具有註釋的地圖視圖開始的iPad應用程序。iOS 6 MKMapView在[EAGLContext setCurrentContext]上崩潰

當我們切換到另一個基於opengl的製圖解決方案(shinobi)的視圖時,通過使用storyboard。 在返回地圖視圖之前,只需觸摸地圖即可移動它。 當我們嘗試移動地圖時,它在[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 ... 
+0

我也面臨着同樣的情況。有人請幫助 –

回答

7

我的忍工作,我們已經對此展開調查 - 這是部分原因是由於蘋果的地圖代碼保持我們的GL-語境的保持。作爲一個臨時的解決方法,你可以創建圖表的dealloc方法一ShinobiChart和零時的GL背景下的一個子類,像這樣:

- (void) dealloc { 
    [super dealloc]; 

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

,或者如果你正在使用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 

希望這會有所幫助,但不要直接聯繫我們 - 我們將有一個全面修復了在我們的下一個版本。

+2

我有這個完全相同的問題,但上述解決方案不解決它:( – theLastNightTrain

+0

升級到2.1.1還沒有解決它 – theLastNightTrain

+0

嗨,通過我們的網站與我們取得聯繫(shinobicontrols.com )如果你仍然有困難 –

0

對於那些誰沒有在dealloc的工作,即使試圖[EAGLContext setCurrentContext:nil];,試試這個

dispatch_async(dispatch_get_main_queue(), ^{ 
     [EAGLContext setCurrentContext:nil]; 
    }); 

EAGLContext應該在主線程中進行設置。