yonaskolb / yonaskolb/XcodeGen

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

Open
#1,345 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached XcodeGenImpl.zip and the project.yml files. In Frameworks/XcodeF, run xcodegen, then run xcodegen in the main directory and test on a device running iOS 16 or later with the app extension and dependency enabled. Compare this with commenting out both entries; done means the generated application embeds and links the local targets without a runtime Library not loaded failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.