Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Enhancement proposal]: Update iOS minimum version to 9.0 or higher, delete dead fallback code #1455

Open
3 of 5 tasks
jmagman opened this issue Mar 8, 2025 · 1 comment · May be fixed by #1456
Open
3 of 5 tasks

Comments

@jmagman
Copy link

jmagman commented Mar 8, 2025

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

Proposal

permission_handler_apple supports Flutter > 2.8.0, which had a minimum iOS requirement of iOS 9.

This is a relevant code from the Flutter 2.8.0 tag that shows 9.0:
https://github.com/flutter/flutter/blob/cf4400006550b70f28e4b4af815151d1e74846c6/packages/flutter_tools/templates/app_shared/ios-objc.tmpl/Runner.xcodeproj/project.pbxproj.tmpl#L286
flutter/flutter#62902

However, the permission_handler_apple podspec claims to support iOS 8 (both 8 and 9 are really old at this point):

This isn't a problem in and of itself, but it means the iOS 8 fallback checks are always dead code.

Current Flutter supports iOS 12 and higher, so you could optionally bump further, but that would require increasing the minimum version of Flutter in the pubspec.

Pitch

Increase the podspec to 9.0.

Remove the dead if (@available(iOS 8.0, *)) check fallbacks


@jmagman
Copy link
Author

jmagman commented Mar 8, 2025

I'm filing this as a one-off to permission-handler (and gelocator Baseflow/flutter-geolocator#1652) because it calls the deprecated -[UIApplication openURL:] totally safely behind an iOS 8.0 availability check

BOOL success = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

This particular deprecated API has a nasty bug where it will always return NO on newer versions of iOS:

Calling this method has no effect. Use the openURL:options:completionHandler: method instead.

https://developer.apple.com/documentation/uikit/uiapplication/openurl(_:)

permission-handler would not hit that bug because of the correct and safe availability check. However, Flutter is being used within Google where maintainers are trying to add linters to avoid this API from being called, and that linter doesn't understand availability. Instead of teaching the linter about availability, it would instead be easier (for them, not you) to remove this usage within permission-handler.

It's dead anyway, so even if this cleanup task only removed -[UIApplication openURL:] I would be happy. :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant