yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
7.01k stars 818 forks source link

Frameworks not Embedding/Linking when SPM package is added with app extension. #1345

Open shreesha-kedilaya opened 1 year ago

shreesha-kedilaya commented 1 year ago

In our project we are using multiple app extensions with multiple local targets and multiple packages. We are encountering with an issue where the local targets are not getting embedded with main application target if we use SPM packages and if we add the same target in app extensions as dependencies.

But if we don't add app extensions every target will embed/link properly. Or if we dont add SPM packages it will embed/link properly. But when both of them is integrated the above issue arise.

Strange thing is, the app builds properly but in run time it fails to link and gives Library not loaded error.

Screenshot 2023-04-05 at 6 14 36 PM

This wont happen with simulator. You will have to run in Device.

Attached a sample project with reproducible case. Please run it in device with automatic signing in with iOS >= 16. XcodeGenImpl.zip

Please comment the app extension target and dependency both in project.yml to see a working application.

Screenshot 2023-04-05 at 6 56 21 PM

Note:

If you face any problem with XcodeF.xcodeproj file please checkout to Frameworks/XcodeF and run xcodegen command. And then run xcodegen command in main directory.