Skip to content

Commit

Permalink
[fix] mapsplugin#2930: ios17 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iizuka-rights committed Oct 3, 2024
1 parent 59f94f8 commit 8b597e8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ios/GoogleMaps/PluginGeocoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ - (void)pluginUnload
}
- (void)pluginInitialize
{
NSArray *countryCodes = [NSLocale ISOCountryCodes];
NSArray *countryCodes;
// NOTE: iOS17だとISOCountryCodees内の値がnilの場合(端末による?)があり、クラッシュするので、regionCodeを使用してLocaleを配列を作る
// SEE: https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2930
if (@available(iOS 17.0, *)) {
countryCodes = [[NSLocale currentLocale] regionCode] ? @[[[NSLocale currentLocale] regionCode]] : [NSLocale ISOCountryCodes];
} else {
countryCodes = [NSLocale ISOCountryCodes];
}

NSMutableArray *countries = [NSMutableArray arrayWithCapacity:[countryCodes count]];
NSString *currentLanguage = [[NSLocale preferredLanguages] objectAtIndex:0];

Expand Down

0 comments on commit 8b597e8

Please sign in to comment.