Skip to content

Chore: add Apple Silicon iOS Simulator support for iOS 26+#871

Closed
arrrrny wants to merge 3 commits into
flutter-ml:developfrom
arrrrny:pr/apple-silicon-ios-simulator
Closed

Chore: add Apple Silicon iOS Simulator support for iOS 26+#871
arrrrny wants to merge 3 commits into
flutter-ml:developfrom
arrrrny:pr/apple-silicon-ios-simulator

Conversation

@arrrrny

@arrrrny arrrrny commented Jun 4, 2026

Copy link
Copy Markdown

Summary

This PR adds Apple Silicon iOS Simulator support for iOS 26+ simulators.

Problem

Google's GoogleMLKit/* pods only ship arm64-iphoneos and x86_64-iphonesimulator slices and exclude arm64 from simulator builds. On Apple Silicon Macs running iOS 26+ simulators (where Rosetta 2 is no longer the default for the iOS Simulator), flutter run fails with Unable to find a destination matching the provided destination specifier.

Upstream Google bug: https://issuetracker.google.com/issues/178965151

Solution

This plugin ships an opt-in Podfile helper that:

  1. Re-labels the existing arm64 device slice as iOS Simulator (the same LC_BUILD_VERSION.platform swap used by the well-known arm64-to-sim tool)
  2. Strips the EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 from the generated xcconfigs

Changes

  • Add apple_silicon_simulator.rb Ruby helper script
  • Add patch_arm64_simulator.py Python script to re-label Mach-O objects
  • Update example Podfile to use the helper
  • Document the solution in README.md

Usage

Add two lines to your iOS Podfile:

require File.expand_path('.symlinks/plugins/google_mlkit_commons/ios/scripts/apple_silicon_simulator', __dir__)

post_install do |installer|
  # ...your existing post_install code...
  mlkit_apple_silicon_simulator_patch(installer)
end

Then re-run pod install. The example app under packages/example is already wired up this way.

Original contribution by @lucasdonordeste

lucasdonordeste and others added 3 commits May 8, 2026 23:41
Apple removed Rosetta 2 from the default iOS 26 simulator runtime, which
breaks `flutter run` for any project depending on Google ML Kit on
Apple Silicon Macs. The published GoogleMLKit/* CocoaPods only ship
arm64-iphoneos and x86_64-iphonesimulator slices and pin
EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64, so the simulator build
no longer finds a matching destination and dies with
"Unable to find a destination matching the provided destination specifier".

Until Google publishes proper arm64-iphonesimulator slices
(https://issuetracker.google.com/issues/178965151), this change ships an
opt-in Podfile helper under google_mlkit_commons that:

1. Re-labels the existing arm64 device slice of every ML Kit framework
   binary as iOS Simulator. Only the 4-byte LC_BUILD_VERSION.platform
   field is changed (2 -> 7), the same approach the well-known
   arm64-to-sim tool uses on closed-source SDKs. Idempotent.
2. Strips EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 from the
   xcconfigs CocoaPods generates from the pod's user_target_xcconfig,
   so the user's app target is allowed to build for arm64-iphonesimulator.

The example/ios Podfile is wired to call the helper from post_install,
which lets the example app build, install and run on an Apple Silicon
iOS 26.3 simulator. End-to-end validated: Text Recognition on the
Text-From-Widget view returned the exact widget text. Device builds and
release builds are not affected.

Closes flutter-ml#825
The Ruby and Python entry points already have a brief header pointing at
the README. Per-function docstrings were restating what the function name
already said, and the Podfile inline comments duplicated the helper's
self-documenting name.
@arrrrny

arrrrny commented Jun 4, 2026

Copy link
Copy Markdown
Author

Closing this PR as duplicate - the changes are already covered by the excellent PR #862 from @lucasdonordeste and the Swift Package Manager changes in PR #870.

A combined reference branch fixed exists in my fork with both changes merged together.

@arrrrny arrrrny closed this Jun 4, 2026
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.

2 participants