Switch Google Maps SDK & Mapkit in the same app cause crash

前端 未结 1 1488
南方客
南方客 2021-01-03 09:26

I created a pretty simple app that uses MapKit and GoogleMaps frameworks and tried to switch between the two maps. I am using ARC (ios 6.1) and Google Maps SDK for iOS versi

1条回答
  •  离开以前
    2021-01-03 09:33

    We were having the same issues after first integrating Google Maps into our iOS app. The solution that seems to work for us so far has been to wait some period of time after releasing the GMSMapView and all related Google Maps objects, prior to instantiating any MapKit objects.

    Based on our testing to thus far, our thought is that the GMSMapView object hierarchy is released asynchronously, and doesn't seem to aggressively re-establish its EAGLContext as "current" prior to releasing OpenGL resources. So if MapKit switches the current EAGLContext, then the GMSMapView hierarchy proceeds with releasing resources, you get a cross pollination of OpenGL resource release.

    So our steps are:

    1. Release GMSMapView, and all GMS related objects
    2. Wait 100ms (0.1 sec)
    3. Set the EAGLEContext to nil
    4. Allocate MKMapView and proceed.

    So far this has worked for us. Good luck.

    0 讨论(0)
提交回复
热议问题