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];