tom*_*n11 3 mapkit ios google-maps-sdk-ios
试图让用户选择在我的应用程序中选择谷歌地图(sdk)和苹果地图(mapkit).该应用程序没有使用ARC.崩溃场景(ios 6.0/6.1):1.进入谷歌地图(模态控制器).2.退出谷歌地图(解雇模态).3.将我的应用程序更改为apple maps(mapkit).4.输入apple maps(模态控制器).
应用程序崩溃,我得到:[EAGLContext setCurrentContext:]
如果我不在dealloc中释放谷歌地图,则不会发生错误,但它可能会导致内存泄漏.我在viewDidLoad中保留地图并在dealloc中释放地图.
有人可以帮忙吗?谢谢,Tomer
1 0x0a041324 in -[VGLGPU init] ()
2 0x0a041032 in __24+[VGLGPU sharedInstance]_block_invoke_0 ()
3 0x03b52014 in _dispatch_client_callout ()
4 0x03b4409f in dispatch_once_f ()
5 0x03b44061 in dispatch_once ()
6 0x0a040fef in +[VGLGPU sharedInstance] ()
7 0x09fab26b in -[VKMainLoop updateLinkState] ()
8 0x09fabb02 in -[VKMainLoop removeCanvas:] ()
9 0x09f9f2aa in -[VKScreenCanvas _updateDisplayStatus:] ()
10 0x09f9f3fb in -[VKScreenCanvas setNeedsDisplay] ()
11 0x027bc03d in -[UIView initWithFrame:] ()
12 0x09f75658 in -[VGLScreenCanvas initWithFrame:context:] ()
15 0x09f907e7 in -[VKMapCanvas initWithFrame:shouldRasterize:] ()
16 0x09f8982e in -[VKMapView initWithFrame:andGlobe:shouldRasterize:] ()
17 0x0267d1a1 in -[MKMapView _commonInitAndEnableLoading:fromIB:] ()
18 0x0267da9c in -[MKMapView initWithCoder:] ()
19 0x02aa8a02 in UINibDecoderDecodeObjectForValue ()
47 0x028671a7 in -[UIViewController presentModalViewController:animated:] ()
Run Code Online (Sandbox Code Playgroud)
适用于iOS的Google Maps SDK和使用Apple Maps的MapKit都使用OpenGL.
Google Maps SDK for iOS存在一些问题,如果意外的OpenGL上下文处于活动状态,可能会导致其崩溃:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=4752
似乎MapKit在OpenGL上下文中也存在一些问题:
显示地图时,iOS 6应用程序在EAGLContext中崩溃
你可能不得不使用一些反复试验来判断你是否能找到解决问题的方法.尝试在地图上执行操作之前和/或之后清除当前上下文(例如,当您发布Google地图时):
[EAGLContext setCurrentContext:nil]
Run Code Online (Sandbox Code Playgroud)
您还可以在执行操作之前尝试保存先前的上下文,然后再次恢复它,例如:
EAGLContext* previousContext = [EAGLContext currentContext];
// Perform map operation here.
[EAGLContext setCurrentContext: previousContext];
Run Code Online (Sandbox Code Playgroud)
当我使用Google Maps SDK for iOS调查问题时,我基本上尝试了各种组合,直到找到了有效的方法.祝好运!