From 8ba6f80c1b0d02f09ab787af7b145345b0f0244d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 24 Nov 2015 12:11:10 -0800 Subject: [PATCH 01/11] Attach compass gesture recognizer to compass view Fixes #3099. --- CHANGELOG.md | 2 ++ platform/ios/MGLMapView.mm | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 712d3116e..c3fb7efba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ Known issues: ## iOS master +- Fixed an issue preventing the compass from responding to taps after the compass is moved programmatically. ([#3116](https://github.com/mapbox/mapbox-gl-native/pull/3116)) + ## iOS 3.0.0 - If you install this SDK via CocoaPods, CocoaPods version 0.38.0 or above is required. ([#2132](https://github.com/mapbox/mapbox-gl-native/pull/2132)) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 646e02cc7..3a0aa6d4b 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -292,10 +292,11 @@ std::chrono::steady_clock::duration durationInSeconds(float duration) _compassView.accessibilityLabel = @"Compass"; _compassView.frame = CGRectMake(0, 0, _compassView.image.size.width, _compassView.image.size.height); _compassView.alpha = 0; + _compassView.userInteractionEnabled = YES; + [_compassView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCompassTapGesture:)]]; UIView *container = [[UIView alloc] initWithFrame:CGRectZero]; [container addSubview:_compassView]; container.translatesAutoresizingMaskIntoConstraints = NO; - [container addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCompassTapGesture:)]]; [self addSubview:container]; // setup interaction From dbe68760ec32938fcab408082345eadfbcf88b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 24 Nov 2015 12:14:21 -0800 Subject: [PATCH 02/11] Corrected changelog [skip ci] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3fb7efba..7cf25bee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ Known issues: ## iOS master -- Fixed an issue preventing the compass from responding to taps after the compass is moved programmatically. ([#3116](https://github.com/mapbox/mapbox-gl-native/pull/3116)) +- Fixed an issue preventing the compass from responding to taps after the compass is moved programmatically. ([#3117](https://github.com/mapbox/mapbox-gl-native/pull/3117)) ## iOS 3.0.0 From e2921f7e7c9d86d6abdca41443dd79bd0089a74e Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Wed, 2 Dec 2015 13:33:11 -0800 Subject: [PATCH 03/11] refs #3112: cleanups around Core Telephony runtime - don't do anything with CT in simulator - more direct use of dynamic selectors for clarity --- platform/ios/MGLMapboxEvents.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index a0f87eeab..239ac7ece 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -76,21 +76,22 @@ const NSTimeInterval MGLFlushInterval = 60; _scale = [UIScreen mainScreen].scale; } +#if !TARGET_OS_SIMULATOR // Collect cellular carrier data if CoreTelephony is linked - Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo"); - if (CTTelephonyNetworkInfo != NULL) { - id telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init]; - + Class MGLTelephony = NSClassFromString(@"CTTelephonyNetworkInfo"); + if (MGLTelephony) { + id telephonyNetworkInfo = [[MGLTelephony alloc] init]; SEL subscriberCellularProviderSelector = NSSelectorFromString(@"subscriberCellularProvider"); - id carrierVendor = ((id (*)(id, SEL))[telephonyNetworkInfo methodForSelector:subscriberCellularProviderSelector])(telephonyNetworkInfo, subscriberCellularProviderSelector); + id carrierVendor = [telephonyNetworkInfo performSelector:subscriberCellularProviderSelector]; // Guard against simulator, iPod Touch, etc. if (carrierVendor) { SEL carrierNameSelector = NSSelectorFromString(@"carrierName"); - NSString *carrierName = ((id (*)(id, SEL))[carrierVendor methodForSelector:carrierNameSelector])(carrierVendor, carrierNameSelector); + NSString *carrierName = [carrierVendor performSelector:carrierNameSelector]; _carrier = carrierName; } } +#endif } return self; } From f67ceec8c24d58dc2c976db8b1c2d0a3e8a68efc Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Wed, 2 Dec 2015 17:36:09 -0500 Subject: [PATCH 04/11] [ios] fix CoreTelephony crash (by removing it) Fix #3112, ref #2581 --- CHANGELOG.md | 2 ++ docs/BUILD_IOS_OSX.md | 1 - platform/ios/MGLMapboxEvents.m | 45 ---------------------------------- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cf25bee4..5d549c3bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ Known issues: ## iOS master +- Fixed CoreTelephony.framework crash. ([#3170](https://github.com/mapbox/mapbox-gl-native/pull/3170)) +- `MGLMapView` methods that alter the viewport now accept optional completion handlers. ([#3090](https://github.com/mapbox/mapbox-gl-native/pull/3090)) - Fixed an issue preventing the compass from responding to taps after the compass is moved programmatically. ([#3117](https://github.com/mapbox/mapbox-gl-native/pull/3117)) ## iOS 3.0.0 diff --git a/docs/BUILD_IOS_OSX.md b/docs/BUILD_IOS_OSX.md index 6a4302520..b862fdf5f 100644 --- a/docs/BUILD_IOS_OSX.md +++ b/docs/BUILD_IOS_OSX.md @@ -83,7 +83,6 @@ Currently, until [#1437](https://github.com/mapbox/mapbox-gl-native/issues/1437) - `libc++.dylib` - `libsqlite3.dylib` - `libz.dylib` - - `CoreTelephony.framework` (optional, telemetry-only) 1. Add `-ObjC` to your target's "Other Linker Flags" build setting (`OTHER_LDFLAGS`). diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 239ac7ece..7f8df6109 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -75,23 +75,6 @@ const NSTimeInterval MGLFlushInterval = 60; } else { _scale = [UIScreen mainScreen].scale; } - -#if !TARGET_OS_SIMULATOR - // Collect cellular carrier data if CoreTelephony is linked - Class MGLTelephony = NSClassFromString(@"CTTelephonyNetworkInfo"); - if (MGLTelephony) { - id telephonyNetworkInfo = [[MGLTelephony alloc] init]; - SEL subscriberCellularProviderSelector = NSSelectorFromString(@"subscriberCellularProvider"); - id carrierVendor = [telephonyNetworkInfo performSelector:subscriberCellularProviderSelector]; - - // Guard against simulator, iPod Touch, etc. - if (carrierVendor) { - SEL carrierNameSelector = NSSelectorFromString(@"carrierName"); - NSString *carrierName = [carrierVendor performSelector:carrierNameSelector]; - _carrier = carrierName; - } - } -#endif } return self; } @@ -510,13 +493,6 @@ const NSTimeInterval MGLFlushInterval = 60; [evt setValue:@((int)(100 * [UIDevice currentDevice].batteryLevel)) forKey:@"batteryLevel"]; [evt setValue:@(strongSelf.data.scale) forKey:@"resolution"]; - if (strongSelf.data.carrier) { - [evt setValue:strongSelf.data.carrier forKey:@"carrier"]; - - NSString *cell = [strongSelf currentCellularNetworkConnectionType]; - [evt setObject:(cell ? cell : [NSNull null]) forKey:@"cellularNetworkType"]; - } - MGLReachability *reachability = [MGLReachability reachabilityForLocalWiFi]; [evt setValue:([reachability isReachableViaWiFi] ? @YES : @NO) forKey:@"wifi"]; @@ -725,27 +701,6 @@ const NSTimeInterval MGLFlushInterval = 60; return result; } -// Can be called from any thread. -// -- (NSString *) currentCellularNetworkConnectionType { - NSString *radioTech; - - Class CTTelephonyNetworkInfo = NSClassFromString(@"CTTelephonyNetworkInfo"); - if (CTTelephonyNetworkInfo) { - id telephonyNetworkInfo = [[CTTelephonyNetworkInfo alloc] init]; - SEL currentRadioAccessTechnologySelector = NSSelectorFromString(@"currentRadioAccessTechnology"); - radioTech = ((id (*)(id, SEL))[telephonyNetworkInfo methodForSelector:currentRadioAccessTechnologySelector])(telephonyNetworkInfo, currentRadioAccessTechnologySelector); - } - - if (radioTech == nil) { - return nil; - } else if ([radioTech hasPrefix:@"CTRadioAccessTechnology"]) { - return [radioTech substringFromIndex:23]; - } else { - return @"Unknown"; - } -} - // Can be called from any thread. // + (BOOL) checkPushEnabled { From 0184b5ba9f1bd2c5bb0288ef21357cccce293cbd Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 3 Dec 2015 11:15:42 -0800 Subject: [PATCH 05/11] bump iOS version to 3.0.1-pre.1 --- ios/Mapbox-iOS-SDK.podspec | 2 +- platform/ios/MGLAccountManager.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index fb6cdce73..7dbf9cc55 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.0.0' + m.version = '3.0.1-pre.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 bindings.' diff --git a/platform/ios/MGLAccountManager.m b/platform/ios/MGLAccountManager.m index 522f3cb0b..aad8423ce 100644 --- a/platform/ios/MGLAccountManager.m +++ b/platform/ios/MGLAccountManager.m @@ -85,7 +85,7 @@ } + (NSString *)kitDisplayVersion { - return @"3.0.0"; + return @"3.0.1-pre.1"; } + (void)initializeIfNeeded { From 0514082eb26096b0896e2555446b61c6f3d38fa6 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 19 Nov 2015 14:30:54 -0800 Subject: [PATCH 06/11] reduce framework binary size with more stripping --- scripts/ios/framework.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ios/framework.sh b/scripts/ios/framework.sh index 81f7b35b9..1d1f75579 100755 --- a/scripts/ios/framework.sh +++ b/scripts/ios/framework.sh @@ -23,6 +23,7 @@ cp -rv ../../../../ios/framework/Settings.bundle Mapbox.framework/Settings.bundl # binary cp -v ../static/libMapbox.a Mapbox.framework/Mapbox +strip -Sx Mapbox.framework/Mapbox # module map mkdir Mapbox.framework/Modules From 6b4e8bac6dddf77268c1d87039b434fbfd4525c7 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Tue, 24 Nov 2015 11:49:12 -0800 Subject: [PATCH 07/11] fixes #3113: bring in MGLMapView via +load for Interface Builder --- platform/ios/MGLAccountManager.m | 5 +++-- platform/ios/MGLCategoryLoader.m | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/platform/ios/MGLAccountManager.m b/platform/ios/MGLAccountManager.m index aad8423ce..eb1b9480d 100644 --- a/platform/ios/MGLAccountManager.m +++ b/platform/ios/MGLAccountManager.m @@ -18,6 +18,9 @@ #pragma mark - Internal + (void)load { + // Load all referenced categories due to absence of -ObjC linker flag + [MGLCategoryLoader loadCategories]; + // Read the initial configuration from Info.plist. The shown-in-app setting // preempts the Settings bundle check in -[MGLMapboxEvents init] triggered // by setting the access token. @@ -35,8 +38,6 @@ // Can be called from any thread. // + (instancetype) sharedManager { - [MGLCategoryLoader loadCategories]; - if (NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) { return nil; } diff --git a/platform/ios/MGLCategoryLoader.m b/platform/ios/MGLCategoryLoader.m index 13d82b19b..50309436b 100644 --- a/platform/ios/MGLCategoryLoader.m +++ b/platform/ios/MGLCategoryLoader.m @@ -4,15 +4,21 @@ #import "NSProcessInfo+MGLAdditions.h" #import "NSString+MGLAdditions.h" -// https://github.com/mapbox/mapbox-gl-native/issues/2966 +#import "MGLMapView.h" @implementation MGLCategoryLoader + (void)loadCategories { + // https://github.com/mapbox/mapbox-gl-native/issues/2966 + // mgl_linkBundleCategory(); mgl_linkProcessCategory(); mgl_linkStringCategory(); + + // https://github.com/mapbox/mapbox-gl-native/issues/3113 + // + NSString *description = [MGLMapView description]; } @end From fec0283ac8f6929f90f36298fd1e4f0d07c9fb27 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 3 Dec 2015 15:49:05 -0800 Subject: [PATCH 08/11] fixes #3180, fixes #3113: bring back -ObjC linker flag Reverts a tiny sliver of 423cfc1 --- gyp/platform-ios.gypi | 1 + 1 file changed, 1 insertion(+) diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi index 205cfe22d..370af4030 100644 --- a/gyp/platform-ios.gypi +++ b/gyp/platform-ios.gypi @@ -88,6 +88,7 @@ '-framework MobileCoreServices', '-framework QuartzCore', '-framework SystemConfiguration', + '-ObjC', ], }, From 9507bc038eb71fe10c0a9e0739ebcef7dbfc7bca Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 3 Dec 2015 16:01:35 -0800 Subject: [PATCH 09/11] fixes #3181: move from vendored lib to framework - Add license file to framework build step to satisfy CocoaPods linting. - Log version when rolling framework (refs #3046). - fixes #1426: get rid of dummy file since we make our own framework. --- ios/Mapbox-iOS-SDK.podspec | 7 +++---- scripts/ios/framework.sh | 4 ++++ scripts/ios/package.sh | 3 --- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 7dbf9cc55..4beabc8bb 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |m| 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}.zip", + :http => "https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/Mapbox.framework-#{m.version.to_s}.zip", :flatten => true } @@ -23,9 +23,8 @@ Pod::Spec.new do |m| m.requires_arc = true m.preserve_paths = '**' - m.source_files = 'Headers/*.h', 'MGLDummy.m' - m.resource_bundle = { 'Mapbox' => 'Mapbox.bundle/*' } - m.vendored_library = 'libMapbox.a' + m.resource_bundle = { 'Mapbox' => 'Mapbox.framework/Mapbox.bundle/*' } + m.vendored_frameworks = 'Mapbox.framework' m.module_name = 'Mapbox' m.frameworks = 'CoreLocation', 'GLKit', 'ImageIO', 'MobileCoreServices', 'QuartzCore', 'SystemConfiguration' diff --git a/scripts/ios/framework.sh b/scripts/ios/framework.sh index 1d1f75579..e2842a470 100755 --- a/scripts/ios/framework.sh +++ b/scripts/ios/framework.sh @@ -18,6 +18,9 @@ cat ../../../../ios/framework/umbrella >> Mapbox.framework/Headers/Mapbox.h # resources cp -rv ../static/Mapbox.bundle Mapbox.framework/Mapbox.bundle +# license +cp -v ../../../../LICENSE.md Mapbox.framework + # settings bundle cp -rv ../../../../ios/framework/Settings.bundle Mapbox.framework/Settings.bundle @@ -31,6 +34,7 @@ cp -v ../../../../ios/framework/modulemap Mapbox.framework/Modules/module.module # Info.plist VERSION=$( git tag | grep ^ios | sed 's/^ios-//' | sort -r | grep -v '\-rc.' | grep -v '\-pre.' | sed -n '1p' | sed 's/^v//' ) +echo "Using $VERSION for Info.plist. Note that you will need to manually update the product for pre-releases or release candidates." cp -v ../../../../ios/framework/Info.plist Mapbox.framework perl -pi -e "s/#####/$VERSION/" Mapbox.framework/Info.plist perl -pi -e "s/%%%%%/$VERSION/" Mapbox.framework/Info.plist diff --git a/scripts/ios/package.sh b/scripts/ios/package.sh index 41694c2f6..7f0fe447d 100755 --- a/scripts/ios/package.sh +++ b/scripts/ios/package.sh @@ -103,9 +103,6 @@ for i in `ls -R include/mbgl/ios | grep -vi private`; do cp -pv include/mbgl/ios/$i "${OUTPUT}/static/Headers" done -step "Setting up dummy source file for CocoaPods 0.37.0..." -echo "// https://github.com/mapbox/mapbox-gl-native/issues/1426" > "${OUTPUT}/static/MGLDummy.m" - # Manually create resource bundle. We don't use a GYP target here because of # complications between faked GYP bundles-as-executables, device build From 8fb141a3e4c1c7b54424c2307953277d1bb215fa Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Mon, 7 Dec 2015 12:21:22 -0800 Subject: [PATCH 10/11] bump build for ios-v3.0.1 (no symbols) --- ios/Mapbox-iOS-SDK.podspec | 2 +- platform/ios/MGLAccountManager.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 4beabc8bb..685e4c5c1 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.0.1-pre.1-symbols' + m.version = '3.0.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 bindings.' diff --git a/platform/ios/MGLAccountManager.m b/platform/ios/MGLAccountManager.m index eb1b9480d..8bfe1d68b 100644 --- a/platform/ios/MGLAccountManager.m +++ b/platform/ios/MGLAccountManager.m @@ -86,7 +86,7 @@ } + (NSString *)kitDisplayVersion { - return @"3.0.1-pre.1"; + return @"3.0.1"; } + (void)initializeIfNeeded { From c8c485090b6033c8dd72973a705d7ba009d120a8 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Mon, 7 Dec 2015 13:01:28 -0800 Subject: [PATCH 11/11] properly point to distributed license file --- ios/Mapbox-iOS-SDK.podspec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 685e4c5c1..00ded8968 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -3,13 +3,13 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' m.version = '3.0.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 bindings.' - m.homepage = 'https://www.mapbox.com/ios-sdk/' - m.license = 'BSD' - m.author = { 'Mapbox' => 'mobile@mapbox.com' } - m.screenshot = 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/ios/screenshot.png' - m.social_media_url = 'https://twitter.com/mapbox' + 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 bindings.' + m.homepage = 'https://www.mapbox.com/ios-sdk/' + m.license = { :type => 'BSD', :file => 'Mapbox.framework/LICENSE.md' } + m.author = { 'Mapbox' => 'mobile@mapbox.com' } + m.screenshot = 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/ios/screenshot.png' + m.social_media_url = 'https://twitter.com/mapbox' m.documentation_url = 'https://www.mapbox.com/ios-sdk/' m.source = {