Xcode 12 issue - Could not find module 'FrameworkName' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64
I fixed this by ensuring the build setting VALID_ARCHS
(now appearing at the bottom of Build Settings in Xcode 12) contains "x86_64
".
That is:
- Before I had:
VALID_ARCHS = arm64, arm64e
- After fixing:
VALID_ARCHS = arm64, arm64e, x86_64
(A little counterintuitive, as the error message says it couldn't find the module for arm64
-apple-ios-simulator, :shrug:)
Could not find module for target 'x86_64-apple-ios-simulator'
To solve this issue I had to create a fat library of my custom framework again using xcode 11 tools.
To do that I did the following:
1) Build YourCustomFramework
target for iOS simulator and extract framework from products folder on your desktop.
Xcode ▸ DerivedData ▸ Your Project ▸ Build ▸ Products ▸ Release-iphonesimulator
2) Build YourCustomFramework
target for Generic iOS Device and extract framework from products folder on your desktop.
Xcode ▸ DerivedData ▸ Your Project ▸ Build ▸ Products ▸ Release-iphoneos
3) Rename the simulator generated framework to YourCustomFramework-sim.framework
so that it is distinguishable later.
4) Use the lipo command to combine both binaries into a single fat binary file. (cd to your desktop or wherever your custom framework file is located)
$lipo -create ./YourCustomFramework-sim.framework/YourCustomFramework ./YourCustomFramework.framework/YourCustomFramework -output ./YourCustomFramework
5) Copy YourCustomFramework
binary file created in above step and replace it with the binary in YourCustomFramework.framework
folder.
6) From folder
YourCustomFramework-sim.framework/Modules/YourCustomFramework.swiftmodule/
copy all of the modules and paste them to
YourCustomFramework.framework/Modules/YourCustomFramework.swiftmodule/
This should solve your issue.
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.
Getting error No such module using Xcode, but the framework is there
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT)
and set it to recursive.
Related Topics
Use More Than One Firebase Database in Single App - Swift
How to Handle Local Notification When App Has Been Terminated
How to Use a Uisplitviewcontroller in Swift
How to Retrieve Image Stored in Firebase to Show It in View Image View
How to Determine If a Business Is Open Given the Hours of Operation (Swift-Ios)
Finding It Difficult to Pass Data to Separate Viewcontroller
Get Latitude and Longitude Center of Google Map
Display UI (Storyboard Possibly) with Broadcast UI Extension
How to Create a CSV File from Core Data (Swift)
Gmsmarker Icon in the Top Left Corner of the View (Ios)
How to Call Secitemcopymatching in Xcode 7 Beta 4
Swift Lazy and Optional Properties
Incorrect Position of Cashapelayer
Self Sizing Uitextview Till Specific Height
Swift - Using Cgcontext to Draw with Finger