Xcode 12 Issue - Could Not Find Module 'Frameworkname' for Target 'Arm64-Apple-Ios-Simulator'; Found: X86_64-Apple-Ios-Simulator, X86_64

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 XCFrameworks 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



Leave a reply



Submit