Embedded frameworks architectures check fail with XCode 12.3

Our iOS apps use to embed and sign third party frameworks built for various architectures (i386 x86_64 armv7 arm64). When building an archive, a script phase strips unwanted architectures (simulator ones) from the build.

Everything was working fine until XCode 12.3 (updated this morning). Now, what seems to be a "Target integrity" check always reports the following error for these embedded frameworks (example with GoogleCast framework):

error: Building for iOS, but the linked and embedded framework 'GoogleCast.framework' was built for iOS + iOS Simulator.

Also, as these frameworks are synced from a server at build time using a script phase, if I delete the frameworks before compiling, there are no errors and the app is built properly. But if the frameworks are already synced, the compilation systematically fails right away.

Finally, other frameworks with the same architectures but that are not embedded don't trigger this error.

I've tried to changes some build settings regarding the architectures but with no success.

Could you please tell me how to embed these frameworks, keeping in mind they are third-party frameworks?

Cheers,
Aurélien
Answered by DTS Engineer in 652565022
The framework isn't built with a supported configuration -- iOS and iOS Simulator should never appear in the same binary. You should follow-up with the support channel for the framework vendor and see if they have a fixed version (which needs to be a XCFramework).
There seems to be an architecture check issue and some updates that weren't included in the release notes: https://developer.apple.com/documentation/xcode-release-notes/xcode-12_3-release-notes/. No idea if this is intentional, a bug, or how to resolve them.
The framework isn't built with a supported configuration -- iOS and iOS Simulator should never appear in the same binary. You should follow-up with the support channel for the framework vendor and see if they have a fixed version (which needs to be a XCFramework).
I'm having the same issue with Twilio.framework. It worked without problem until the last 12.3 beta.

And after updating to the last macOS 15.15.7, Xcode is freezing after every single click. :/
I met this problem also.I can rebuilt the third party framework to 2 frameworks with ios and ios simulator architecture respectively.So, now my problem is how to add framework for ios and ios simulator building separately?
I finally solved my problem with 'xcframework'.I combined 'arm64' framework and 'x86_64' framework into a 'xcframework', and use the xcframework in my project, the problem solved.
Same thing happened with my project. I believe that this is an intentional change by Apple to force developers to start distributing xcframeworks with support for arm64 simulators (M1 Macs). Fat binary frameworks don't work anymore because simulators and actual devices can have the same architecture. The proper solution is to repack the GoogleCast framework into xcframework. You can do this by splitting the fat binary into two using lipo (one for simulator and one for real devices). If you don't want to do this, you can enable "Validate workspace" in build settings. This will enable you to build your project and only output a warning.
So, as I cannot wait for third party XCFrameworks to be delivered, I went through the path of repacking the legacy frameworks into XCFrameworks and it works fine, as long as the XCFrameworks are there when compiling (which is not necessary with common frameworks). But this is another story.

For those interested in how to create these XCFrameworks on the fly, here is how I managed to do so:
  1. Create an aggregate target in your project

  2. Add a build phase script to this new target to build the XCFrameworks

  3. Edit the scheme of the primary target (the one for your app) and add the aggregate target to the top of the targets list (build tab)

  4. Uncheck "Parallelize Build" to preserve the targets order

We had the same issue with an 3rd party library. Going to Build Settings and setting Validate Workspace to Yes solved it for us.
The proper way to solve this problem would be repacking the embedded framework with XCFramewotk but there is a work around to solve this in the meantime.
Go to Build Settings > Build Options and change the property value of Validate Workspace to YES. You should be all set.

Refer to xcodebuildsettings.com to understand more about this configuration.
Embedded frameworks architectures check fail with XCode 12.3
 
 
Q