iOS 6 MKMapView偶尔会在initWithFrame中崩溃

Bre*_*ght 28 ios ios6 ios6-maps

我在苹果商店有一个应用程序,在iOS6更新后,我收到了数百份崩溃报告MKMapView.我无法在我的设备上重现崩溃.这看起来像是一个问题EAGLContext.我们不在我们的应用程序中使用OpenGL,但是我们MKMapView在不同的控制器中有多个实例.我发现一个类似的问题,iOS 6应用程序在显示地图时在EAGLContext中崩溃但他们使用OpenGL.

这里有回溯:

Exception Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0x1
Crashed Thread:  0

Thread 0 Crashed:
0   libGPUSupportMercury.dylib          0x00000e22 gpus_ReturnNotPermittedKillClient + 10
1   libGPUSupportMercury.dylib          0x3bccc5fb gldCreateContext + 190
2   GLEngine                            0x344c2b15 gliCreateContextWithShared + 676
3   OpenGLES                            0x0000491d -[EAGLContext initWithAPI:properties:] + 1433
4   OpenGLES                            0x000042d7 -[EAGLContext initWithAPI:sharedWithCompute:] + 143
5   VectorKit                           0x00011c81 -[VGLGPU init] + 105
6   VectorKit                           0x000d4659 __24+[VGLGPU sharedInstance]_block_invoke_0 + 49
7   libdispatch.dylib                   0x000014b7 _dispatch_client_callout + 23
8   libdispatch.dylib                   0x000073f7 dispatch_once_f$VARIANT$mp + 43
9   VectorKit                           0x00011c13 +[VGLGPU sharedInstance] + 39
10  VectorKit                           0x00001db1 -[VKMainLoop updateLinkState] + 485
11  VectorKit                           0x00001955 -[VKScreenCanvas _updateDisplayStatus:] + 109
12  UIKit                               0x0001c371 -[UIView initWithFrame:] + 129
13  VectorKit                           0x00010ca5 -[VGLScreenCanvas initWithFrame:context:] + 53
14  VectorKit                           0x00010a7d -[VKScreenCanvas initWithFrame:context:] + 57
15  VectorKit                           0x00010a3f -[VKScreenCanvas initWithFrame:] + 39
16  VectorKit                           0x000106bd -[VKMapCanvas initWithFrame:shouldRasterize:] + 65
17  VectorKit                           0x000104bb -[VKMapView initWithFrame:andGlobe:shouldRasterize:] + 647
18  MapKit                              0x0000dc95 -[MKMapView _commonInitAndEnableLoading:fromIB:] + 725
19  MapKit                              0x0000d811 -[MKMapView initWithFrame:] + 257
.....
Run Code Online (Sandbox Code Playgroud)

stu*_*ckj 24

当我们正在弹出一个包含地图子视图的窗口时,我们遇到了类似的问题.由于地图在我们背景时使用openGL调用,似乎发生了崩溃.我们必须将地图子视图创建包装在如下所示的检查中:

UIApplicationState appState = [[UIApplication sharedApplication] applicationState];
    if( (appState != UIApplicationStateBackground) && (appState != UIApplicationStateInactive))
    {
        // Do map subview initialization...
    }
    else
    {
        self.attemptedToLoadMap = YES;
    }
Run Code Online (Sandbox Code Playgroud)

我们保存了bool,以便如果应用程序返回到前台,我们可以添加子视图以供显示.

您必须在导致重新绘制操作(例如,添加注释)的方式操作地图时执行此操作.