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

Fixed NSLocale.languageCode crash in iOS 9.3 #12123

Merged
merged 4 commits into from
Jun 11, 2018

Conversation

julianrex
Copy link
Contributor

@julianrex julianrex commented Jun 11, 2018

Fixes #12063 (same bug as #7399)

@julianrex julianrex added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Jun 11, 2018
@julianrex julianrex added this to the ios-v4.1.0 milestone Jun 11, 2018
@@ -109,7 +109,9 @@ + (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 = [[NSLocale localeWithLocaleIdentifier:language] objectForKey:NSLocaleLanguageCode];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to wrap in a if #available statement so when we remove iOS 9 support we also remove this code and keep the latest API?

Copy link
Contributor Author

@julianrex julianrex Jun 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep we can do that - I'll modify the previous case of this too (that was a historic case).

Copy link
Contributor

@fabian-guerra fabian-guerra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@@ -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 on iOS 9.3 (`NSLocale.languageCode` introduced in iOS 10.0) ([#12123](https://github.com/mapbox/mapbox-gl-native/pull/12123))
Copy link
Contributor

@friedbunny friedbunny Jun 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be specific as to how the crash was triggered, so we’ll want to mention -[MGLStyle localizeLabelsIntoLocale:] (instead of NSLocale directly).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@friedbunny to avoid waiting more I can fix this changelog in #12086

@julianrex julianrex merged commit ed76230 into master Jun 11, 2018
@fabian-guerra fabian-guerra deleted the jrex-12063-languageCode-2 branch June 11, 2018 19:24
@@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/iOS 9.3/macOS 10.11/
s/iOS 10.0/macOS 10.12/
The way we use “Darwin” in this repository is a bit misleading – we don’t actually do any kernel programming – so we avoid mentioning that term in public-facing documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know - how do we normally reference code that is shared between iOS and macOS? "shared platform code"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in #12146

Copy link
Contributor

@friedbunny friedbunny Jun 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we normally reference code that is shared between iOS and macOS

We don’t tend to acknowledge the existence of other platforms in the changelogs.

julianrex pushed a commit that referenced this pull request Jun 14, 2018
julianrex added a commit that referenced this pull request Jun 14, 2018
julianrex added a commit that referenced this pull request Jun 14, 2018
fabian-guerra pushed a commit that referenced this pull request Jun 22, 2018
… iOS 9.3 (#12123)

# Conflicts:
#	platform/ios/CHANGELOG.md
#	platform/macos/CHANGELOG.md
fabian-guerra pushed a commit that referenced this pull request Jun 22, 2018
… iOS 9.3 (#12123)

# Conflicts:
#	platform/ios/CHANGELOG.md
#	platform/macos/CHANGELOG.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants