Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios,macos] Fixed crash in -[MGLStyle localizeLabelsIntoLocale:] on…
Browse files Browse the repository at this point in the history
… iOS 9.3 (#12123)

# Conflicts:
#	platform/ios/CHANGELOG.md
#	platform/macos/CHANGELOG.md
  • Loading branch information
julianrex authored and fabian-guerra committed Jun 22, 2018
1 parent 1642dd9 commit 1c7ad8f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion platform/darwin/src/MGLVectorTileSource.mm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,16 @@ + (NSString *)preferredMapboxStreetsLanguage {
+ (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;
Expand Down
2 changes: 2 additions & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

* 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

* Fixed a crash when constant expressions were used for style properties that didn't support data-driven styling. ([#11960](https://github.com/mapbox/mapbox-gl-native/issues/11960))
Expand Down
2 changes: 2 additions & 0 deletions platform/macos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog for Mapbox Maps SDK for macOS

* 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))

## 0.7.1

### Style layers
Expand Down

0 comments on commit 1c7ad8f

Please sign in to comment.