dpogue opened a new pull request, #1698: URL: https://github.com/apache/cordova-ios/pull/1698
I expect this to be potentially controversial given the state of APIs here, but I believe it is safe and will remove the need for the geolocation plugin for apps targeting iOS 15 and newer. It would be nice if there were a way to test that this passes Apple's automatic API usage scan before merging 😕 ### Platforms affected iOS (15+) ### Motivation and Context <!-- Why is this change required? What problem does it solve? --> <!-- If it fixes an open issue, please link to the issue here. --> This method allows controlling whether access to the geolocation API is available based on the origin requesting access. This resolves the primary reason that the Cordova Geolocation plugin exists. ### Description <!-- Describe your changes in detail --> However, the API is only available as public API in iOS 27 and newer, but has been available as private API with the same signature since iOS 15. Since we're allowed to declare the public API now, we can do that and then dynamically alias it to the private API for older iOS versions. A new `GeolocationPermissionGrantType` preference is supported in config.xml, following the same rules as the media permissions. If not specified, the app scheme will have access to geolocation APIs, but no other origins. Any geolocation access requires the `NSLocationWhenInUseUsageDescription` option to be set in Info.plist, otherwise the app will crash when initializing Location Services. ### Testing <!-- Please describe in detail how you tested your changes. --> Confirmed that this allows geolocation to work with just a single prompt in a Cordova app, without the need for the geolocation plugin. ### Checklist - [ ] I've run the tests to see all new and existing tests pass - [ ] I added automated test coverage as appropriate for this change - [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`) - [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) - [ ] I've updated the documentation if necessary -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
