summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@gmail.com>2018-06-11 15:23:40 -0400
committerJulian Rex <julian.rex@mapbox.com>2018-06-11 15:27:33 -0400
commitb00bf0feb26c94b7604a5a8ea92512b0c40be448 (patch)
treec8772ff4f8b9ab8ca80dfa98e36a6fb17d92c8d9
parentfd8e8263e533ba86a9422adf230726922948c186 (diff)
downloadqtlocation-mapboxgl-b00bf0feb26c94b7604a5a8ea92512b0c40be448.tar.gz
[ios,macos] Fixed crash in `-[MGLStyle localizeLabelsIntoLocale:]` on iOS 9.3 (#12123)
-rw-r--r--platform/darwin/src/MGLVectorTileSource.mm11
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/macos/CHANGELOG.md2
3 files changed, 13 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLVectorTileSource.mm b/platform/darwin/src/MGLVectorTileSource.mm
index e55ed13060..88ddee1d98 100644
--- a/platform/darwin/src/MGLVectorTileSource.mm
+++ b/platform/darwin/src/MGLVectorTileSource.mm
@@ -109,7 +109,16 @@ static NSArray * const MGLMapboxStreetsAlternativeLanguages = @[
+ (NSString *)preferredMapboxStreetsLanguageForPreferences:(NSArray<NSString *> *)preferencesArray {
BOOL acceptsEnglish = [preferencesArray filteredArrayUsingPredicate:
[NSPredicate predicateWithBlock:^BOOL(NSString * _Nullable language, NSDictionary<NSString *,id> * _Nullable bindings) {
- return [[NSLocale localeWithLocaleIdentifier:language].languageCode isEqualToString:@"en"];
+ NSString *languageCode;
+
+ if (@available(iOS 10.0, macOS 10.12.0, *)) {
+ languageCode = [NSLocale localeWithLocaleIdentifier:language].languageCode;
+ }
+ else {
+ languageCode = [[NSLocale localeWithLocaleIdentifier:language] objectForKey:NSLocaleLanguageCode];
+ }
+
+ return [languageCode isEqualToString:@"en"];
}]].count;
NSArray<NSString *> *availableLanguages = acceptsEnglish ? MGLMapboxStreetsLanguages : MGLMapboxStreetsAlternativeLanguages;
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 2d9f3007c3..e14ff94f94 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -21,6 +21,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Added custom `-hitTest:withEvent:` to `MGLSMCalloutView` to avoid registering taps in transparent areas of the standard annotation callout. ([#11939](https://github.com/mapbox/mapbox-gl-native/pull/11939))
* Improved performance and memory impact of `MGLScaleBar`. ([#11921](https://github.com/mapbox/mapbox-gl-native/pull/11921))
* Fixed race conditions that could cause crashes when re-using `MGLMapSnapshotter` or using multiple snapshotters at the same time. ([#11831](https://github.com/mapbox/mapbox-gl-native/pull/11831))
+* Fixed crash in `-[MGLStyle localizeLabelsIntoLocale:]` on iOS 9.3 (attempting to access a property that was introduced in iOS 10.0) ([#12123](https://github.com/mapbox/mapbox-gl-native/pull/12123))
## 4.0.2 - May 29, 2018
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index 8d5f450268..2a9eb13a88 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -16,6 +16,8 @@
* Adjusted when and how the camera transition update and finish callbacks are called, fixing recursion bugs. ([#11614](https://github.com/mapbox/mapbox-gl-native/pull/11614))
* Fixed an issue preventing nested key path expressions get parsed accordingly to the spec. ([#11959](https://github.com/mapbox/mapbox-gl-native/pull/11959))
* Fixed race conditions that could cause crashes when re-using `MGLMapSnapshotter` or using multiple snapshotters at the same time. ([#11831](https://github.com/mapbox/mapbox-gl-native/pull/11831))
+* Fixed crash in `-[MGLStyle localizeLabelsIntoLocale:]` on iOS 9.3 (attempting to access a property that was introduced in iOS 10.0 and used in Darwin code) ([#12123](https://github.com/mapbox/mapbox-gl-native/pull/12123))
+
## 0.7.1