Xcode building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'
Basically, you have to exclude arm64
for the simulator architecture, both from your project and the Pod project.
To do that, navigate to Build Settings of your project and add Any iOS Simulator SDK with value
arm64
inside Excluded Architecture.
OR
If you are using custom
XCConfig
files, you can simply add this line for excluding simulator architecture.EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
Then
You have to do the same for the Pod project until all the Cocoa pod vendors are done adding following in their Podspec.
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }You can manually add the Excluded Architecture in your Pod project's Build Settings, but it will be overwritten when you
usepod install
.In place of this, you can add this snippet in your
Podfile
. It will write the necessary Build Settings every time you runpod install
.post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta
In the target's General tab, there is an Embedded Binaries field. When you add the framework there the crash is resolved.
Reference is here on Apple Developer Forums.
Xcode 12.3: Building for iOS Simulator, but the linked and embedded framework was built for iOS + iOS Simulator
I'm afraid that this is actually the correct error and the framework shouldn't contain iOS and iOS Simulator code at the same time. Apple tries to force us to use XCFramework
s for this purpose. They started it in Xcode 11 and just tightened up the restrictions.
The only correct way to resolve this is to rebuild the framework as an XCFramework. Which is easy to do:
xcrun xcodebuild -create-xcframework \
-framework /path/to/ios.framework \
-framework /path/to/sim.framework \
-output combined.xcframework
You can start with a combined .framework
. Make two copies of the framework, and use lipo
to remove the slices from the binary that are associated with a different SDK.
It is based on the original answer from Apple here.
My particular case is that I'm getting this error using Rome, which produces these frameworks (a possible solution is here). Also, a lot of struggling is going on on the Carthage side.
Related Topics
How to Replace the Values of Labels in iOS-Charts
Unwrapping Optional in Swiftui View
Swift: Differencebetween a Typealias and an Associatedtype with a Value in a Protocol
Fullscreen for Swift Playgrounds on iPad
Swiftui View Does Not Updated When Observedobject Changed
How to Apply Animation for One Specific Modifier Change Only
How to Change Its Own Button Image on Tap in Swift
Appdelegate Segue Alternative Pass Data
Swift Unit Testing with Xctassertthrows Analogue
Mandatory Init Override in Swift Uinavigationcontroller Subclass
Behaviour of Protocols with Self
How to Trigger Updateuiview of a Uiviewrepresentable
C-Style Uninitialized Pointer Passing in Apple Swift
How to Set an Initial Value for @Nsmanaged Property Pfobject Subclass
Xcode Generated Coredata Files Cannot Be Processed by Copy Bundle Resources Build Phase