From 5cacbb45058005e72baa49b8d8cd0eb2deb9d029 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 29 Sep 2016 18:35:07 -0400 Subject: [PATCH 1/9] [ios][build] Generate debug symbols for all builds Fixes the issue where our stripped dynamic build did not have a valid dSYM. Disabling GCC_GENERATE_DEBUGGING_SYMBOLS for SYMBOLS=NO builds meant that those builds had no debug symbols to strip or add to a dSYM. --- platform/ios/DEVELOPING.md | 2 +- platform/ios/scripts/package.sh | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/platform/ios/DEVELOPING.md b/platform/ios/DEVELOPING.md index 4efc6af48..a31eac284 100644 --- a/platform/ios/DEVELOPING.md +++ b/platform/ios/DEVELOPING.md @@ -51,7 +51,7 @@ You can customize the build output by passing the following arguments into the ` * `BUILDTYPE=Release` will optimize for distribution. Defaults to `Debug`. * `BUILD_DEVICE=false` builds only for the iOS Simulator. * `FORMAT=dynamic` builds only a dynamic framework. `FORMAT=static` builds only a static framework, for compatibility with iOS 7.x. -* `SYMBOLS=NO` strips the build output of any debug symbols, yielding much smaller binaries. +* `SYMBOLS=NO` strips the build output of any debug symbols, yielding much smaller binaries. Defaults to `YES`. An example command that creates a dynamic framework suitable for eventual App Store distribution: diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index c753c63df..8ad779d6b 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -11,7 +11,7 @@ PRODUCTS=${DERIVED_DATA}/Build/Products BUILDTYPE=${BUILDTYPE:-Debug} BUILD_FOR_DEVICE=${BUILD_DEVICE:-true} -GCC_GENERATE_DEBUGGING_SYMBOLS=${SYMBOLS:-YES} +SYMBOLS=${SYMBOLS:-YES} BUILD_DYNAMIC=true BUILD_STATIC=true @@ -42,7 +42,7 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then fi IOS_SDK_VERSION=`xcrun --sdk ${SDK} --show-sdk-version` -echo "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${GCC_GENERATE_DEBUGGING_SYMBOLS}; self-contained static framework: ${SELF_CONTAINED:-NO}" +echo "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${SYMBOLS}; self-contained static framework: ${SELF_CONTAINED:-NO}" function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } function finish { >&2 echo -en "\033[0m"; } @@ -79,7 +79,6 @@ elif [[ ${BUILD_STATIC} == true ]]; then fi xcodebuild \ - GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ CURRENT_SHORT_VERSION=${SHORT_VERSION} \ CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \ @@ -94,7 +93,6 @@ xcodebuild \ if [[ ${BUILD_FOR_DEVICE} == true ]]; then xcodebuild \ - GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ CURRENT_PROJECT_VERSION=${PROJ_VERSION} \ CURRENT_SHORT_VERSION=${SHORT_VERSION} \ CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \ @@ -111,7 +109,7 @@ fi LIBS=(Mapbox.a mbgl-core.a mbgl-platform-ios.a) # https://medium.com/@syshen/create-an-ios-universal-framework-148eb130a46c -if [[ "${BUILD_FOR_DEVICE}" == true ]]; then +if [[ ${BUILD_FOR_DEVICE} == true ]]; then if [[ ${BUILD_STATIC} == true ]]; then step "Assembling static framework for iOS Simulator and devices…" mkdir -p ${OUTPUT}/static/${NAME}.framework @@ -168,8 +166,8 @@ else cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/Settings.bundle ${STATIC_SETTINGS_DIR} fi -if [[ "${GCC_GENERATE_DEBUGGING_SYMBOLS}" == false ]]; then - step "Stripping binaries…" +if [[ ${SYMBOLS} = NO ]]; then + step "Stripping symbols from binaries…" if [[ ${BUILD_STATIC} == true ]]; then strip -Sx "${OUTPUT}/static/${NAME}.framework/${NAME}" fi From 47f73d3f643d0c047931cc408be2dcdcef5131cf Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 30 Sep 2016 05:20:15 -0400 Subject: [PATCH 2/9] [ios][build] Validate dSYM and framework UUIDs --- platform/ios/scripts/package.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index 8ad779d6b..00aae9b88 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -167,7 +167,7 @@ else fi if [[ ${SYMBOLS} = NO ]]; then - step "Stripping symbols from binaries…" + step "Stripping symbols from binaries" if [[ ${BUILD_STATIC} == true ]]; then strip -Sx "${OUTPUT}/static/${NAME}.framework/${NAME}" fi @@ -176,6 +176,27 @@ if [[ ${SYMBOLS} = NO ]]; then fi fi +function get_comparable_uuid { + echo $(dwarfdump --uuid ${1} | sed -n 's/.*UUID:\([^\"]*\) .*/\1/p' | sort) +} + +function validate_dsym { + step "Validating dSYM and framework UUIDs…" + DSYM_UUID=$(get_comparable_uuid "${1}") + FRAMEWORK_UUID=$(get_comparable_uuid "${2}") + echo -e "${1}\n ${DSYM_UUID}\n${2}\n ${FRAMEWORK_UUID}" + if [[ ${DSYM_UUID} != ${FRAMEWORK_UUID} ]]; then + echo "Error: dSYM and framework UUIDs do not match." + exit 1 + fi +} + +if [[ ${BUILD_DYNAMIC} == true && ${BUILDTYPE} == Release ]]; then + validate_dsym \ + "${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME}" \ + "${OUTPUT}/dynamic/${NAME}.framework/${NAME}" +fi + function create_podspec { step "Creating local podspec (${1})" [[ $SYMBOLS = YES ]] && POD_SUFFIX="-symbols" || POD_SUFFIX="" From 36738c00259572402909c3862420c17ad980fe25 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Mon, 19 Sep 2016 15:43:45 -0400 Subject: [PATCH 3/9] [ios] Don't specify Swift version for jazzy doc generation (#6377) --- platform/ios/scripts/document.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/platform/ios/scripts/document.sh b/platform/ios/scripts/document.sh index a4fd5b98b..62ec7824f 100755 --- a/platform/ios/scripts/document.sh +++ b/platform/ios/scripts/document.sh @@ -19,8 +19,6 @@ BRANCH=$( git describe --tags --match=ios-v*.*.* --abbrev=0 ) SHORT_VERSION=$( echo ${BRANCH} | sed 's/^ios-v//' ) RELEASE_VERSION=$( echo ${SHORT_VERSION} | sed -e 's/^ios-v//' -e 's/-.*//' ) -SWIFT_VERSION=$(xcrun swift -version | head -n 1 | sed -e 's/^Apple Swift version //' -e 's/ .*$//') - rm -rf /tmp/mbgl mkdir -p /tmp/mbgl/ README=/tmp/mbgl/README.md @@ -37,7 +35,6 @@ cp platform/ios/screenshot.png "${OUTPUT}" jazzy \ --config platform/ios/jazzy.yml \ --sdk iphonesimulator \ - --swift-version $SWIFT_VERSION \ --github-file-prefix https://github.com/mapbox/mapbox-gl-native/tree/${BRANCH} \ --module-version ${SHORT_VERSION} \ --readme ${README} \ From 32be7b6cc389af6d4a83b9795bd0c7ceb2edd228 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Tue, 18 Oct 2016 14:32:32 -0700 Subject: [PATCH 4/9] [ios] Optimize event uploading (#6737) Upload any events collected when the app was in use for apps that only have "when in use" location permissions. Also, for all apps, avoid posting event data if there is only a single event. --- platform/ios/src/MGLMapboxEvents.m | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 53b917f70..4d62e9d72 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -129,6 +129,7 @@ const NSTimeInterval MGLFlushInterval = 180; @implementation MGLMapboxEvents { NSString *_instanceID; + UIBackgroundTaskIdentifier _backgroundTaskIdentifier; } + (void)initialize { @@ -257,9 +258,20 @@ const NSTimeInterval MGLFlushInterval = 180; } - (void)pauseOrResumeMetricsCollectionIfRequired { + UIApplication *application = [UIApplication sharedApplication]; + // Prevent blue status bar when host app has `when in use` permission only and it is not in foreground if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse && - [UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { + application.applicationState == UIApplicationStateBackground) { + + if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) { + _backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{ + [application endBackgroundTask:_backgroundTaskIdentifier]; + _backgroundTaskIdentifier = UIBackgroundTaskInvalid; + }]; + [self flush]; + } + [self pauseMetricsCollection]; return; } @@ -307,7 +319,10 @@ const NSTimeInterval MGLFlushInterval = 180; return; } - if ([self.eventQueue count] == 0) { + if ([self.eventQueue count] <= 1) { + [self.eventQueue removeAllObjects]; + [[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier]; + _backgroundTaskIdentifier = UIBackgroundTaskInvalid; return; } @@ -485,10 +500,12 @@ const NSTimeInterval MGLFlushInterval = 180; if (error) { [strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"Network error", @"error": error}]; - return; + } else { + [strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"post", + @"debug.eventsCount": @(events.count)}]; } - [strongSelf pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription: @"post", - @"debug.eventsCount": @(events.count)}]; + [[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier]; + _backgroundTaskIdentifier = UIBackgroundTaskInvalid; }]; }); } From 392450786d3bd66f426ae55c115bcbf00115dff6 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Wed, 5 Oct 2016 11:53:47 -0700 Subject: [PATCH 5/9] [ios] Observer that app did become active instead of will foreground (#6600) --- platform/ios/src/MGLMapboxEvents.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 4d62e9d72..d86114d01 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -209,7 +209,7 @@ const NSTimeInterval MGLFlushInterval = 180; [[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]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidBecomeActiveNotification object:nil]; // Watch for Low Power Mode change events if (&NSProcessInfoPowerStateDidChangeNotification != NULL) { From 0a1d9849fa82f0ebd86b4960d363997bc7d3b896 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Thu, 11 Aug 2016 09:23:58 -0700 Subject: [PATCH 6/9] [ios] Guard against nil data task (#5932) --- platform/ios/src/MGLAPIClient.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/ios/src/MGLAPIClient.m b/platform/ios/src/MGLAPIClient.m index fb13113c8..b9b0dc17c 100644 --- a/platform/ios/src/MGLAPIClient.m +++ b/platform/ios/src/MGLAPIClient.m @@ -63,7 +63,9 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; dataTask = nil; }]; [dataTask resume]; - [self.dataTasks addObject:dataTask]; + if (dataTask) { + [self.dataTasks addObject:dataTask]; + } } - (void)postEvent:(nonnull MGLMapboxEventAttributes *)event completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler { From 95ae8332447a545e753882bde2889fb9fd599b7c Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Thu, 21 Jul 2016 11:51:42 -0700 Subject: [PATCH 7/9] [ios] Add simulator dSYM slices to build output. (#5740) Our release builds for device (with lipoed simulator binary) create a dSYM files for both the device and simulator. However the script only copied the device dSYM file to the output location. This adds a step to lipo together both the device and simulator dSYM files. Mapbox.framework.dSYM now holds armv7 and arm64 slices. --- platform/ios/scripts/package.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index 00aae9b88..405868a06 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -127,9 +127,19 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then cp -r \ ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework \ ${OUTPUT}/dynamic/ + if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM ]]; then + step "Copying dSYM" cp -r ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM \ - ${OUTPUT}/dynamic/ + ${OUTPUT}/dynamic/ + if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM ]]; then + step "Merging device and simulator dSYMs…" + lipo \ + ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} \ + ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} \ + -create -output ${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} + lipo -info ${OUTPUT}/dynamic/${NAME}.framework.dSYM/Contents/Resources/DWARF/${NAME} + fi fi step "Merging simulator dynamic library into device dynamic library…" @@ -158,6 +168,7 @@ else ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework \ ${OUTPUT}/dynamic/${NAME}.framework if [[ -e ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM ]]; then + step "Copying dSYM" cp -r ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.framework.dSYM \ ${OUTPUT}/dynamic/ fi From 057b7b75cec08a2d65e714bb52655cf3960c20f1 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 27 Oct 2016 18:28:10 -0700 Subject: [PATCH 8/9] [core] Band-aid for crash triggered by unbound element buffer (#6844) --- src/mbgl/geometry/vao.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mbgl/geometry/vao.hpp b/src/mbgl/geometry/vao.hpp index 150a6badb..5ab784c0c 100644 --- a/src/mbgl/geometry/vao.hpp +++ b/src/mbgl/geometry/vao.hpp @@ -44,6 +44,9 @@ public: storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); } } else { + // Band-aid for https://github.com/mapbox/mapbox-gl-native/issues/5731 + elementsBuffer.bind(store); + verifyBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset); } } From f41421ff776e8216844477ac0433c6e48fd875dd Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Tue, 25 Oct 2016 22:50:50 -0700 Subject: [PATCH 9/9] ios-v3.3.5 --- platform/ios/CHANGELOG.md | 7 +++++++ platform/ios/Mapbox-iOS-SDK-symbols.podspec | 2 +- platform/ios/Mapbox-iOS-SDK.podspec | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 43ccc9c0d..ec702cd3c 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,6 +2,13 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. +## 3.3.5 + +* Speculatively fixed an OpenGL rendering crash. ([#6844](https://github.com/mapbox/mapbox-gl-native/pull/6844)) +* Fixed an issue with symbols not being properly stripped from the dynamic framework. The dSYM file included with the standard dynamic framework in previous releases (e.g., `mapbox-ios-sdk-3.3.4-dynamic.zip` or the `Mapbox-iOS-SDK` pod) could not be used to symbolicate crashes. ([#6531](https://github.com/mapbox/mapbox-gl-native/pull/6531)) +* Include simulator architecture slices in the dSYM file that is generated for release builds. ([#5740](https://github.com/mapbox/mapbox-gl-native/pull/5740)) +* Fixed a rare networking-related crash. ([#5932](https://github.com/mapbox/mapbox-gl-native/pull/5932)) + ## 3.3.4 * Fixed an issue that caused the user dot to be selected when tapping an annotation that lies within the user dot’s accuracy circle. First attempt was [#5816](https://github.com/mapbox/mapbox-gl-native/pull/5816) in v3.3.2, which excluded the pulsing halo but not the accuracy circle. ([#5894](https://github.com/mapbox/mapbox-gl-native/pull/5894)) diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec index 35c394f39..518448c20 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.3.4-symbols' + m.version = '3.3.5-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 69704e8f3..bba175fe4 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.3.4' + m.version = '3.3.5' 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.'