Cannot build Archive for a SwiftUI app that uses a XCFramework

Hi,

My SwiftUI app uses a third-party framework (written in objc, say with name Foo) that is built into a XCFramework. I can build and run this app in iOS simulator and an iPhone connected to my Mac. But when I do "Product" -> "Archive", it fails with the error:

Cannot find 'Foo' in scope

The error is reported at anywhere that uses things like Foo.bar().

Why would Archive fail while both simulator and real device works with the framework? What's the extra thing does Archive do?

XCode version: 14.2

Target setting -> General -> Frameworks, Libraries and Embedded Content: "Embed & Sign".

Thanks.

I have found the root cause: I missed setting "Objective-C Bridging Header" for Release.

The reason that the build worked for both the simulator and the device is that both of them are running the app in Debug mode, not in Release mode. But Archive requires building in Release mode.

Now I've added the bridging header in the Build Setting for Release mode and the issue is gone.

Cannot build Archive for a SwiftUI app that uses a XCFramework
 
 
Q