summaryrefslogtreecommitdiff
path: root/platform/ios/MGLMapView.mm
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-07-09 16:55:38 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-07-11 15:38:59 -0700
commitf96fef82928698df1d047de1a27cf6d856dee8b8 (patch)
tree02917c4e0362b72561062aad364f0c57746607c3 /platform/ios/MGLMapView.mm
parent00308be14093bce1632d2d66e302a35d8a1572b8 (diff)
downloadqtlocation-mapboxgl-f96fef82928698df1d047de1a27cf6d856dee8b8.tar.gz
Create GLKView before binding it and resuming
Or: don’t resume the map until the application has entered the foreground. UIApplicationWillEnterForegroundNotification is posted before UIApplicationDidBecomeActiveNotification, while the application is still in the background. That caused -createGLView to bail but did not cause the rest of -wakeGL: to bail. We would create the GLKView only after attempting to bind it (a no-op), resulting in a black view. Fixes #1855.
Diffstat (limited to 'platform/ios/MGLMapView.mm')
-rw-r--r--platform/ios/MGLMapView.mm22
1 files changed, 4 insertions, 18 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 055877194c..6cb46e28a9 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -213,7 +213,6 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
[self createGLView];
}
-
self.accessibilityLabel = @"Map";
self.backgroundColor = [UIColor clearColor];
self.clipsToBounds = YES;
@@ -251,7 +250,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
//
_annotationIDsByAnnotation = [NSMapTable mapTableWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory];
- _annotationImages = [NSMutableDictionary new];
+ _annotationImages = [NSMutableDictionary dictionary];
std::string defaultSymbolName([MGLDefaultStyleMarkerSymbolName UTF8String]);
_mbglMap->setDefaultPointAnnotationSymbol(defaultSymbolName);
@@ -376,9 +375,7 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
- (void)createGLView
{
- if (_context || [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
- return;
- }
+ if (_context) return;
// create context
//
@@ -415,17 +412,6 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
});
}
-- (void)viewWillEnterForeground
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:UIApplicationWillEnterForegroundNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:UIApplicationDidBecomeActiveNotification
- object:nil];
- [self commonInit];
-}
-
- (void)reachabilityChanged:(NSNotification *)notification
{
MGLReachability *reachability = [notification object];
@@ -797,11 +783,11 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
{
MGLAssertIsMainThread();
- [self createGLView];
- if (self.isDormant)
+ if (self.isDormant && [UIApplication sharedApplication].applicationState != UIApplicationStateBackground)
{
self.dormant = NO;
+ [self createGLView];
[MGLMapboxEvents validate];
self.glSnapshotView.hidden = YES;