When upgrading to Xcode 12.3, getting the error:
Building for iOS, but the embedded framework 'opus.framework' was built for iOS + iOS Simulator
But everything is ok before the update.
When upgrading to Xcode 12.3, getting the error:
Building for iOS, but the embedded framework 'opus.framework' was built for iOS + iOS Simulator
But everything is ok before the update.
It could be helped to try to set your "Validate Workspace" of "Build Options" in "Build Settings" as Yes.
Edit: This was an observation that could help those who use Carthage.
Apparently the most popular solution to this problem described in this answer.
setting Validate Workspace to Yes in the Build Settings tab
Also, the observation of this answer is correct
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 for this purpose. They started it in XCode 11 and just tightened up the restrictions.
Every other solution (other than xcframework usage) seems to become increasingly temporary in the coming Xcode versions.
This is an issue if you are using Carthage and you have added a framework with Embed & Sign
.
For this to work properly you have to follow the steps that Carthage page provide:
If you're building for iOS, tvOS, or watchOS
Create a Cartfile that lists the frameworks you’d like to use in your project.
Run
carthage update
. This will fetch dependencies into a Carthage/Checkouts folder, then build each one or download a pre-compiled framework.Open your application targets’ General settings tab. For Xcode 11.0 and higher, in the "Frameworks, Libraries, and Embedded Content" section, drag and drop each framework you want to use from the Carthage/Build folder on disk. Then, in the "Embed" section, select "Do Not Embed" from the pulldown menu for each item added. For Xcode 10.x and lower, in the "Linked Frameworks and Libraries" section, drag and drop each framework you want to use from the Carthage/Build folder on disk.
On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex:
/bin/sh
), add the following contents to the script area below the shell:/usr/local/bin/carthage copy-frameworks
Create a file named
input.xcfilelist
and a file namedoutput.xcfilelist
Add the paths to the frameworks you want to use to your
input.xcfilelist
. For example:$(SRCROOT)/Carthage/Build/iOS/Result.framework $(SRCROOT)/Carthage/Build/iOS/ReactiveSwift.framework $(SRCROOT)/Carthage/Build/iOS/ReactiveCocoa.framework
Add the paths to the copied frameworks to the
output.xcfilelist
. For example:$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Result.framework $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ReactiveSwift.framework $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ReactiveCocoa.framework
With output files specified alongside the input files, Xcode only needs to run the script when the input files have changed or the output files are missing. This means dirty builds will be faster when you haven't rebuilt frameworks with Carthage.
Add the
input.xcfilelist
to the "Input File Lists" section of the Carthage run script phaseAdd the
output.xcfilelist
to the "Output File Lists" section of the Carthage run script phase
Maybe this is a temporary fix for other cases also. (dependencies that are not build with Carthage)