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).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…