本文介绍了Google Maps SDK& Mapkit在同一个应用程序中导致崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试让用户在我的应用中选择谷歌地图(sdk)和苹果地图(mapkit)。
应用程序未使用ARC。
崩溃场景(ios 6.0 / 6.1):
1.输入谷歌地图(模态控制器)。
2.退出谷歌地图(解雇模态)。
3.将我的应用程序更改为apple maps(mapkit)。
4.输入apple maps(模态控制器)。

trying to give the user the option to choose between google maps (sdk) and apple maps (mapkit) in my app.the app is not using ARC.crash scenario (ios 6.0 / 6.1):1. enter google maps (modal controller).2. exit google maps (dismiss modal).3. change in my app to apple maps (mapkit).4. enter apple maps (modal controller).

应用程序崩溃,我得到:
[EAGLContext setCurrentContext:]

the app crashes and i get: [EAGLContext setCurrentContext:]

错误赢了'如果我不在dealloc中释放谷歌地图,则会发生,但它可能会导致内存泄漏。
我在viewDidLoad中保留地图并在dealloc中释放地图。

the error won't occur if i don't release google maps in the dealloc, but it's probably will cause a memory leak.i retain the map in viewDidLoad and release the map in the dealloc.

任何人都可以帮忙吗?
谢谢,
Tomer

can anyone help?thanks,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:] ()


推荐答案

iOS版Google Maps SDK和使用Apple Maps的MapKit都使用OpenGL。

Both the Google Maps SDK for iOS and MapKit using Apple Maps make use of OpenGL.

Google Maps SDK for iOS存在一些问题,如果意外的OpenGL上下文处于活动状态,可能会导致其崩溃:

The Google Maps SDK for iOS has some issues which can cause it to crash if an unexpected OpenGL context is active:

似乎MapKit在OpenGL上下文中也存在一些问题:

It seems that MapKit also has some issues with the OpenGL context:

iOS 6应用在显示地图时在EAGLContext中崩溃

你可能不得不使用一些反复试验来判断你是否能算出来找出一种方法来阻止这个问题。尝试在地图上执行操作之前和/或之后清除当前上下文(例如,当您发布Google地图时):

You will probably have to use a bit of trial-and-error to see if you can figure out a way to stop the problem. Try clearing the current context before and/or after you perform operations on a map (such as when you release the Google Map):

[EAGLContext setCurrentContext:nil]

您还可以在执行操作之前尝试保存上一个上下文,并且然后再恢复它,例如:

You can also try saving the previous context before performing an operation, and then restoring it again afterwards, for example:

EAGLContext* previousContext = [EAGLContext currentContext];

// Perform map operation here.

[EAGLContext setCurrentContext: previousContext];

当我调查iOS版谷歌地图SDK的问题时,我基本上尝试过这些问题的各种组合直到我发现一些有用的东西。祝你好运!

When I was investigating the issues with the Google Maps SDK for iOS, I basically tried various combinations of these until I found something which worked. Good luck!

这篇关于Google Maps SDK& Mapkit在同一个应用程序中导致崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 01:00