Skip to content

fix(device_info_plus): guard iOS vision selector#3832

Open
andyzhshg wants to merge 1 commit into
fluttercommunity:mainfrom
andyzhshg:fix/device-info-ios-vision-selector
Open

fix(device_info_plus): guard iOS vision selector#3832
andyzhshg wants to merge 1 commit into
fluttercommunity:mainfrom
andyzhshg:fix/device-info-ios-vision-selector

Conversation

@andyzhshg
Copy link
Copy Markdown

Description

This PR fixes an iOS crash in device_info_plus when collecting iOS device info on some iOS 26.1 runtimes.

Crash signature:

NSInvalidArgumentException: -[_NSSwiftProcessInfo isiOSAppOnVision]: unrecognized selector sent to instance
  device_info_plus -[FPPDeviceInfoPlusPlugin handleMethodCall:result:] (FPPDeviceInfoPlusPlugin.m:35)

The existing implementation guarded the call with @available(iOS 26.1, *), but availability only confirms that the SDK/runtime version is new enough. It does not guarantee that the concrete NSProcessInfo instance responds to the Objective-C selector. In the crash above the object is _NSSwiftProcessInfo, and sending isiOSAppOnVision directly can raise an unrecognized selector exception.

This change keeps the default value as false and only invokes isiOSAppOnVision after verifying that the NSProcessInfo instance responds to the selector. It also adds a focused regression test for the native source guard so this crash path does not get reintroduced accidentally.

Verification run for the affected package:

flutter test
flutter analyze
dart analyze . --fatal-infos
git diff --check

Related Issues

No existing upstream issue was found for this specific isiOSAppOnVision crash signature.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant