[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.
This commit is contained in:
Julian Rex
2019-10-11 15:16:12 -04:00
committed by GitHub
parent 2fb1e47b75
commit a1f124c394
2 changed files with 28 additions and 1 deletions

View File

@@ -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);
}
}
}

View File

@@ -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