summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/src/MGLMapView+Impl.mm7
-rw-r--r--platform/ios/src/MGLMapView+OpenGL.mm23
2 files changed, 25 insertions, 5 deletions
diff --git a/platform/ios/src/MGLMapView+Impl.mm b/platform/ios/src/MGLMapView+Impl.mm
index 9cdab4dc63..0b9ab75699 100644
--- a/platform/ios/src/MGLMapView+Impl.mm
+++ b/platform/ios/src/MGLMapView+Impl.mm
@@ -3,6 +3,10 @@
#import "MGLStyle_Private.h"
#import "NSBundle+MGLAdditions.h"
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#import "MMEEventsManager.h"
+#endif
+
std::unique_ptr<MGLMapViewImpl> MGLMapViewImpl::Create(MGLMapView* nativeView) {
return std::make_unique<MGLMapViewOpenGLImpl>(nativeView);
}
@@ -61,6 +65,9 @@ void MGLMapViewImpl::onDidFailLoadingMap(mbgl::MapLoadError mapError, const std:
NSLocalizedFailureReasonErrorKey: @(what.c_str()),
};
NSError *error = [NSError errorWithDomain:MGLErrorDomain code:code userInfo:userInfo];
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+ [[MMEEventsManager sharedManager] reportError:error];
+#endif
[mapView mapViewDidFailLoadingMapWithError:error];
}
diff --git a/platform/ios/src/MGLMapView+OpenGL.mm b/platform/ios/src/MGLMapView+OpenGL.mm
index e599024e26..ad30b608e5 100644
--- a/platform/ios/src/MGLMapView+OpenGL.mm
+++ b/platform/ios/src/MGLMapView+OpenGL.mm
@@ -2,6 +2,11 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLMapView+OpenGL.h"
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#import "MMEConstants.h"
+#import "MGLMapboxEvents.h"
+#endif
+
#include <mbgl/gl/renderable_resource.hpp>
#import <GLKit/GLKit.h>
@@ -96,7 +101,7 @@ void MGLMapViewOpenGLImpl::setPresentsWithTransaction(const bool value) {
void MGLMapViewOpenGLImpl::display() {
auto& resource = getResource<MGLMapViewOpenGLRenderableResource>();
-#ifdef MGL_RECREATE_GL_IN_AN_EMERGENCY
+
// See https://github.com/mapbox/mapbox-gl-native/issues/14232
// glClear can be blocked for 1 second. This code is an "escape hatch",
// an attempt to detect this situation and rebuild the GL views.
@@ -106,14 +111,22 @@ void MGLMapViewOpenGLImpl::display() {
CFTimeInterval after = CACurrentMediaTime();
if (after - before >= 1.0) {
+#ifdef MGL_RECREATE_GL_IN_AN_EMERGENCY
dispatch_async(dispatch_get_main_queue(), ^{
emergencyRecreateGL();
});
- }
- }
- else
+#else
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSError *error = [NSError errorWithDomain:MGLErrorDomain
+ code:MGLErrorCodeRenderingError
+ userInfo:@{ NSLocalizedFailureReasonErrorKey :
+ @"https://github.com/mapbox/mapbox-gl-native/issues/14232" }];
+ [[MMEEventsManager sharedManager] reportError:error];
+ });
#endif
- {
+ }
+ } else {
[resource.glView display];
}
}