From a70928c995504567e85d0b34c2e10c104a72634c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Mon, 4 Apr 2016 10:54:57 -0700 Subject: [PATCH 1/5] ios-v3.2.0-rc.1 Switched away from the -symbols build but added a new podspec that still uses it. --- platform/ios/Mapbox-iOS-SDK-symbols.podspec | 28 +++++++++++++++++++++ platform/ios/Mapbox-iOS-SDK.podspec | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 platform/ios/Mapbox-iOS-SDK-symbols.podspec diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec new file mode 100644 index 000000000..606e8c7c9 --- /dev/null +++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec @@ -0,0 +1,28 @@ +Pod::Spec.new do |m| + + m.name = 'Mapbox-iOS-SDK' + m.version = '3.2.0-rc.1-symbols' + + m.summary = 'Open source vector map solution for iOS with full styling capabilities.' + m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' + m.homepage = 'https://www.mapbox.com/ios-sdk/' + m.license = { :type => 'BSD', :file => 'LICENSE.md' } + m.author = { 'Mapbox' => 'mobile@mapbox.com' } + m.screenshot = 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/ios/screenshot.png' + m.social_media_url = 'https://twitter.com/mapbox' + m.documentation_url = 'https://www.mapbox.com/ios-sdk/' + + m.source = { + :http => "https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/mapbox-ios-sdk-#{m.version.to_s}-dynamic.zip", + :flatten => true + } + + m.platform = :ios + m.ios.deployment_target = '8.0' + + m.requires_arc = true + + m.vendored_frameworks = 'dynamic/Mapbox.framework' + m.module_name = 'Mapbox' + +end diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index b226ef780..4ee0a8796 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.2.0-beta.3-symbols' + m.version = '3.2.0-rc.1' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' From b8ecbf6b357a20ffd0b9d40c7425aac2a7b5d409 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Tue, 5 Apr 2016 11:34:59 -0400 Subject: [PATCH 2/5] ios-v3.2.0 Update podspec files for version 3.2.0 --- platform/ios/Mapbox-iOS-SDK-symbols.podspec | 2 +- platform/ios/Mapbox-iOS-SDK.podspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec index 606e8c7c9..ae71f801a 100644 --- a/platform/ios/Mapbox-iOS-SDK-symbols.podspec +++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.2.0-rc.1-symbols' + m.version = '3.2.0-symbols' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index 4ee0a8796..68429fb1f 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.2.0-rc.1' + m.version = '3.2.0' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' From e5fa7093daf8d93800a06e6ce39c451ea8943e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 18 Apr 2016 23:13:42 -0700 Subject: [PATCH 3/5] [ios] Fixed hang observing user defaults on background queue Fixed a deadlock that could occur if the host application attempts to set user defaults on a background queue. Now we observer user defaults changes synchronously. Cherry-picked from d76ef6e53b56d163df823e7970e18cafd402bbb3. --- platform/ios/CHANGELOG.md | 4 ++++ platform/ios/src/MGLMapboxEvents.m | 18 ++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 68049be4c..d038fafe2 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,6 +2,10 @@ Mapbox welcomes participation and contributions from everyone. If you’d like to do so please see [CONTRIBUTING.md](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started. +## 3.2.1 + +- Fixed a hang that could occur if the host application attempts to set user defaults on a background queue. ([#4745](https://github.com/mapbox/mapbox-gl-native/pull/4745)) + ## 3.2.0 - If you’ve previously installed the SDK as a static framework, the installation workflow has changed to address issues when submitting your application to the App Store or installing it on a device. Upon upgrading to this version of the SDK, you’ll need to add Mapbox.bundle to the Copy Bundle Resources build phase and remove Mapbox.framework from the Embed Frameworks build phase. ([#4455](https://github.com/mapbox/mapbox-gl-native/pull/4455)) diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 13540bfd0..930095351 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -128,7 +128,6 @@ const NSTimeInterval MGLFlushInterval = 180; @end @implementation MGLMapboxEvents { - id _userDefaultsObserver; NSString *_instanceID; } @@ -195,17 +194,8 @@ const NSTimeInterval MGLFlushInterval = 180; self.canEnableDebugLogging = YES; } - // Watch for changes to telemetry settings by the user - __weak MGLMapboxEvents *weakSelf = self; - _userDefaultsObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSUserDefaultsDidChangeNotification - object:nil - queue:[NSOperationQueue mainQueue] - usingBlock: - ^(NSNotification *notification) { - MGLMapboxEvents *strongSelf = weakSelf; - [strongSelf pauseOrResumeMetricsCollectionIfRequired]; - }]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidEnterBackgroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationWillEnterForegroundNotification object:nil]; @@ -229,7 +219,7 @@ const NSTimeInterval MGLFlushInterval = 180; } - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:_userDefaultsObserver]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; [self pauseMetricsCollection]; } @@ -245,6 +235,10 @@ const NSTimeInterval MGLFlushInterval = 180; return _instanceID; } +- (void)userDefaultsDidChange:(NSNotification *)notification { + [self pauseOrResumeMetricsCollectionIfRequired]; +} + - (void)pauseOrResumeMetricsCollectionIfRequired { // Prevent blue status bar when host app has `when in use` permission only and it is not in foreground if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse && From 302f69fdedada6e120e211b12c565bdc8c517609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Tue, 19 Apr 2016 08:02:57 -0700 Subject: [PATCH 4/5] [ios] Assert that defaults change is on main thread Cherry-picked from e7ddaa9285fc5e6433a1faed0bf0a426d34d596a. --- platform/ios/src/MGLMapboxEvents.m | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 930095351..929a9616d 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -236,6 +236,7 @@ const NSTimeInterval MGLFlushInterval = 180; } - (void)userDefaultsDidChange:(NSNotification *)notification { + MGLAssertIsMainThread(); [self pauseOrResumeMetricsCollectionIfRequired]; } From 78ddcd76ee4b3ca1f3f958cf3cb089bacd0d4df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Tue, 19 Apr 2016 08:54:39 -0700 Subject: [PATCH 5/5] [ios] Toggle telemetry on main queue Cherry-picked from 3c4049c796270772184e4dd647c05e73774445e4. --- platform/ios/src/MGLMapboxEvents.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 929a9616d..2dc7fee28 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -236,8 +236,9 @@ const NSTimeInterval MGLFlushInterval = 180; } - (void)userDefaultsDidChange:(NSNotification *)notification { - MGLAssertIsMainThread(); - [self pauseOrResumeMetricsCollectionIfRequired]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self pauseOrResumeMetricsCollectionIfRequired]; + }); } - (void)pauseOrResumeMetricsCollectionIfRequired {