Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: report analyze image as unsupported on iOS Simulator #1275

Conversation

navaronbracke
Copy link
Collaborator

It seems that the iOS Simulator does not support the neural engine features that are required to run the Vision API,
hence why it fails to create the underlying detection model.

Fixes #1269

@@ -22,5 +22,6 @@ class MobileScannerErrorCodes {
const val NO_CAMERA_ERROR_MESSAGE = "No cameras available."
const val SET_SCALE_WHEN_STOPPED_ERROR = "MOBILE_SCANNER_SET_SCALE_WHEN_STOPPED_ERROR"
const val SET_SCALE_WHEN_STOPPED_ERROR_MESSAGE = "The zoom scale cannot be changed when the camera is stopped."
const val UNSUPPORTED_OPERATION_ERROR = "MOBILE_SCANNER_UNSUPPORTED_OPERATION" // Reserved for future use.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added here too, for feature parity with the iOS / macOS implementation, in case we need it in the future.

@@ -48,17 +48,17 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
var standardZoomFactor: CGFloat = 1

public static func register(with registrar: FlutterPluginRegistrar) {
#if os(iOS)
#if os(iOS)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatted the compiler preprocessor directives to not have an indent, which is commonplace for these.

@navaronbracke navaronbracke merged commit 07ad095 into juliansteenbakker:ios-vision Jan 6, 2025
4 checks passed
@navaronbracke navaronbracke deleted the ios_simulator_analyze_image branch January 6, 2025 13:16
@navaronbracke navaronbracke mentioned this pull request Jan 6, 2025
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