Hello, In my IOS app, I have been working on implementing a third-party library's xcframework into my app. (They don't provide spm or cocoapods). However, whenever I import the XCFramework into my app, the build is successful, but when uploading to App Store Connect, I receive an email with an error stating the Swift Support folder is missing. This app was made using SwiftUI. I have a sample project linked below. Other apps also use this framework, so I'm not sure where I'm going wrong.
Thanks for the test project! Your XCFramework has the following contents, edited down for clarity:
SampleForDevSupport/TNoodleLibNative.xcframework
├── Info.plist
├── ios-arm64
│ └── lib-scrambles.dylib
└── ios-x86_64-simulator
└── lib-scrambles.dylib
That bare dylib file is then going to be directly embedded in your app, at a path like Your.app/Frameworks/lib-scrambles.dylib
. That runs afoul of the framework embedding rules that I describe in another thread, which in turn is the top reason people ask for help with these Invalid Swift Support
errors.
In case this is a point of confusion in your circumstance, an XCFramework is not the same as having a framework bundle, which is what is actually required here. An XCFramework is a container, into which multiple copies of a .framework
(which is the part that matters) are included.
There's multiple paths to resolution here. I'm outlining them all for the many people who may come across this thread in the future:
- If this library is yours, you should configure it to build starting from the Framework template from File > New Target in Xcode, and adding your source code to the new target.
- If you don't need this to be a dynamic library, you could also reconfigure it to build as a static library instead, which completely bypasses the framework embedding rule — whether that's a good choice or not really depends on the surrounding project circumstances.
- If you're building this outside of Xcode with a different set of build tools, you could configure the external build tools to emit a static library instead, same as the previous point other than those build tools substituting for Xcode.
- If you're getting this XCFramework already compiled from a vendor, you'll need to take this up with them, though feel free to point them to this thread for the same advice on how to resolve the issue here.
Implementing a third-party library's xcframework into my app
Thus, the solution you need here for your circumstance is my last point.
— Ed Ford, DTS Engineer