infinitered / infinitered/react-native-mlkit
iOS: Apple Silicon simulator requires Rosetta due to non-xcframework MLKit deps
- Dominant language
- TypeScript
- Stars
- 444
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
On Apple Silicon Macs, `@infinitered/react-native-mlkit-face-detection` transitively pulls in `GoogleMLKit/FaceDetection` versions that ship as classic fat `.framework` bundles (arm64 = device-only, no arm64-simulator slice). CocoaPods injects `EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64` into the host app's xcconfig to compensate, which forces the iOS simulator to build as x86_64 and run under Rosetta translation.
In that Rosetta-translated simulator, `PHPickerViewController` (the system image picker) is unreliable — the XPC plugin crashes on open, reproducibly:
```
[PlugInKit] [com.apple.mobileslideshow.photospicker(1.0)] Connection to plugin interrupted while in use.
[PlugInKit] [com.apple.mobileslideshow.photospicker(1.0)] Connection to plugin invalidated while in use.
[PhotosUI] Showing picker unavailable UI (reason: crashed) with error: (null)
```
The picker UI renders thumbnails then becomes fully unresponsive to touch. Running on a physical device works fine.
## Repro / Evidence
- `@infinitered/react-native-mlkit-face-detection@5.0.0`
- `@infinitered/react-native-mlkit-core@5.0.0`
- CocoaPods resolves transitively to:
- `GoogleMLKit/FaceDetection (~> 7.0.0)`
- `MLKitFaceDetection (~> 5.0.0)`
- `MLKitCommon (~> 11.0.0)`
- `MLKitVision (~> 7.0)`
- `Pods-*.debug.xcconfig` contains `EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64`
Removing the exclusion to try arm64 simulator produces the expected linker error:
```
ld: building for 'iOS-simulator', but linking in object file
(Pods/MLImage/Frameworks/MLImage.framework/MLImage[arm64][2](GMLImage.o))
built for 'iOS'
```
...confirming the arm64 slice in the fat framework is device-only, not simulator.
## Environment
- Expo SDK 55, React Native 0.83.4, Hermes, Fabric enabled
- macOS arm64 (Apple Silicon, native — not under Rosetta)
- Xcode 16, iOS 18.6 simulator
## Request
Google now publishes MLKit pods as proper `.xcframework` bundles with dedicated `ios-arm64-simulator` slices in newer releases. Could the podspecs in this repo (`RNMLKitFaceDetection.podspec`, `RNMLKitCore.podspec`) be updated to depend on GoogleMLKit versions that ship xcframeworks? That would remove the need for `EXCLUDED_ARCHS = arm64` and let consumers build the simulator natively on Apple Silicon, avoiding the Rosetta + PHPicker failure mode.
Contributor guide
Research direction
Inspect RNMLKitFaceDetection.podspec and RNMLKitCore.podspec, then compare their GoogleMLKit dependency versions with releases that provide ios-arm64-simulator xcframework slices. Reproduce the current Pods-*.debug.xcconfig architecture exclusion and linker failure on an Apple Silicon simulator. Done means the dependencies use compatible xcframework releases and the simulator builds natively without excluding arm64.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100