From 1cdf320057aae4e129189fc4af92f1a948be9380 Mon Sep 17 00:00:00 2001 From: Paulo Santana Date: Fri, 17 May 2024 09:13:04 -0300 Subject: [PATCH] [FIX] From https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2930 --- src/ios/GoogleMaps/PluginGeocoder.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ios/GoogleMaps/PluginGeocoder.m b/src/ios/GoogleMaps/PluginGeocoder.m index 2ccfcaa28..ee5c47319 100644 --- a/src/ios/GoogleMaps/PluginGeocoder.m +++ b/src/ios/GoogleMaps/PluginGeocoder.m @@ -21,7 +21,14 @@ - (void)pluginUnload } - (void)pluginInitialize { - NSArray *countryCodes = [NSLocale ISOCountryCodes]; + NSArray *countryCodes; + if (@available(iOS 17.0, *)) { + // Use regionCode for iOS 17 and above + countryCodes = [[NSLocale currentLocale] regionCode] ? @[ [[NSLocale currentLocale] regionCode] ] : [NSLocale ISOCountryCodes]; + } else { + // Use ISOCountryCodes for versions below iOS 17 + countryCodes = [NSLocale ISOCountryCodes]; + } NSMutableArray *countries = [NSMutableArray arrayWithCapacity:[countryCodes count]]; NSString *currentLanguage = [[NSLocale preferredLanguages] objectAtIndex:0];