Skip to content

Error PluginGeocoder.m iOS 17 #2930

@keriroso

Description

@keriroso

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:
Captura de pantalla 2024-05-14 a la(s) 09 28 37

Captura de pantalla 2024-05-14 a la(s) 09 29 47

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions