xcodebuild "building for iOS Simulator, but linking ... built for iOS" arch slice in CI
On Apple silicon runners the iOS Simulator is arm64, the same architecture as a real device. A framework that ships only the device arm64 slice links into a simulator build with the wrong platform, and the linker rejects it.
What this error means
The simulator build fails with "building for iOS Simulator, but linking in object file (.../SomeKit) built for iOS" or "ld: in ..., building for iOS Simulator, but linking ... built for iOS".
ld: building for 'iOS-simulator', but linking in object file
(SomeKit.framework/SomeKit) built for 'iOS'
clang: error: linker command failed with exit code 1Common causes
A device-only arm64 framework
The binary framework has an ios-arm64 slice but no ios-arm64-simulator slice, so on Apple silicon the simulator build links a device object.
A fat framework cannot separate the two arm64 platforms
Universal fat frameworks tag arm64 once and cannot distinguish device from simulator; only XCFrameworks carry both platform variants.
How to fix it
Adopt an XCFramework with a simulator slice
- Replace the device-only framework with an XCFramework that includes ios-arm64-simulator.
- Clean DerivedData so the new slice is used.
- Rebuild the simulator target.
xcodebuild -create-xcframework \
-framework device/SomeKit.framework \
-framework simulator/SomeKit.framework \
-output SomeKit.xcframeworkBuild the simulator target under x86_64 as a stopgap
If only a device/x86_64 framework exists, run the simulator build via Rosetta or exclude arm64 for the simulator SDK.
xcodebuild -scheme App \
-destination 'platform=iOS Simulator,name=iPhone 16' \
EXCLUDED_ARCHS=arm64 buildHow to prevent it
- Distribute binary frameworks as XCFrameworks with device and simulator slices.
- On Apple silicon runners, ensure simulator slices are arm64.
- Avoid blanket
EXCLUDED_ARCHS=arm64as a permanent fix; prefer XCFrameworks.