Occasionally iOS 6 MKMapView crashes in initWithFrame

前端 未结 4 870
傲寒
傲寒 2020-12-13 00:35

I\'ve an app on the apple store and after the iOS6 update I\'ve got hundred of crash report within MKMapView. I cannot manage to reproduce the crash on my devic

4条回答
  •  天涯浪人
    2020-12-13 01:12

    We were having a similar problem when user's background our app just as we're popping up a window that includes a map subview. The crash seemed to be happening due to the map using an openGL call while we're backgrounded. We had to wrap the map subview creation in a check like the following:

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

    We saved off the bool so that if the app comes back to the foreground we can add the subview in for display.

    You have to do this anytime you're manipulating the map in a way that causes a re-draw operation (e.g., adding an annotation).

提交回复
热议问题