-
Notifications
You must be signed in to change notification settings - Fork 916
Description
I'm submitting a ... (check one with "x")
- question
- any problem or bug report
OS: (check one with "x")
- Android
- iOS
- Browser
Current behavior:
Hello, I am experiencing an issue with one of my applications. The Cordova-Google-Maps plugin is failing on iOS 17, specifically in the initialization of the Geocoder plugin that uses NSLocale ISOCountryCodes to get a list of country codes.
Expected behavior:
Screen capture or video record:

Related code, data or error log (please format your code or data):
Reason: In iOS 17, the option to extract NSLocale ISOCountryCodes country codes in Objective-c is not supported in this new version of the operating system, resulting in a nil value being returned and causing the application to terminate unexpectedly.
Action taken: A manual adjustment was made to the plugin by validating an action found in the Apple developer manual,
The system version is validated and based on this, a different action is taken for iOS 17, regionCode is used and not 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];
}
