aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-10-11 15:16:12 -0400
committerGitHub <noreply@github.com>2019-10-11 15:16:12 -0400
commita1f124c39442d76af77a5aa63bba5afa4f4d6d26 (patch)
tree266c783ff174d256934b3e596cedef6e62d70e35
parent2fb1e47b75c038f226397df7b790ba699b6e2dc8 (diff)
[ios] Fix for iOS 9 crash (seen in simulator) (#15771)
* [ios] Fix for iOS 9 crash (seen in simulator) * [ios] Update change log * [ios, macos] Add #if around new function.
-rw-r--r--platform/darwin/src/MGLSDKMetricsManager.m28
-rw-r--r--platform/ios/CHANGELOG.md1
2 files changed, 28 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLSDKMetricsManager.m b/platform/darwin/src/MGLSDKMetricsManager.m
index 828fbcd50..0ef9ecda1 100644
--- a/platform/darwin/src/MGLSDKMetricsManager.m
+++ b/platform/darwin/src/MGLSDKMetricsManager.m
@@ -18,6 +18,23 @@ NSString* MGLStringFromMetricType(MGLMetricType metricType) {
return eventName;
}
+// Taken verbatim from NXFreeArchInfo header documentation
+#if TARGET_OS_IOS
+static void MGLFreeArchInfo(const NXArchInfo *x)
+{
+ const NXArchInfo *p;
+
+ p = NXGetAllArchInfos();
+ while(p->name != NULL){
+ if(x == p)
+ return;
+ p++;
+ }
+ free((char *)x->description);
+ free((NXArchInfo *)x);
+}
+#endif
+
@interface MGLMetricsManager() <MGLNetworkConfigurationMetricsDelegate>
@property (strong, nonatomic) NSDictionary *metadata;
@@ -54,7 +71,16 @@ NSString* MGLStringFromMetricType(MGLMetricType metricType) {
if (localArchInfo) {
abi = @(localArchInfo->description);
- NXFreeArchInfo(localArchInfo);
+
+ NSProcessInfo *processInfo = [NSProcessInfo processInfo];
+
+ // Although NXFreeArchInfo appears to be weakly linked, it does
+ // not have the weak_import attribute, so check the OS version.
+ if (&NXFreeArchInfo && [processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 0, 0}]) {
+ NXFreeArchInfo(localArchInfo);
+ } else {
+ MGLFreeArchInfo(localArchInfo);
+ }
}
}
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index b3eab70c6..5a7235b25 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -22,6 +22,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Fixed an issue that cause `-[MGLMapView setCamere:withDuration:animationTimingFunction:edgePadding:completionHandler:]` persist the value of `edgePadding`. ([#15584](https://github.com/mapbox/mapbox-gl-native/pull/15584))
* Added `MGLMapView.automaticallyAdjustsContentInset` property that indicates if wether the map view should automatically adjust its content insets. ([#15584](https://github.com/mapbox/mapbox-gl-native/pull/15584))
* Fixed an issue that caused `MGLScaleBar` to have an incorrect size when resizing or rotating. ([#15703](https://github.com/mapbox/mapbox-gl-native/pull/15703))
+* Fixed crash at launch seen on iOS 9 simulator. ([#15771](https://github.com/mapbox/mapbox-gl-native/pull/15771))
## 5.4.0 - September 25, 2019