XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Conditional dependencies based on `xcodebuild` version

Open alessionossa opened this issue 3 years ago • 0 comments

I am trying to add App Intents to our app (not in an App Intents Extension, so it is not related to ). I am working with Xcode 14 beta while my colleagues are still working on Xcode 13 on the same project. There is an issue by Apple [FB10630607 - AppIntents framework linked on iOS 15 when using AppEntity/EntityQuery] that causes the app to crash on launch if compiled for iOS 15 from Xcode 14 because the app looks for AppIntents.framework, which is not present in iOS 15.5.

Apple suggested this workaround:

[...] you can manually add AppIntents.framework to your target’s “Link Binary With Libraries” Build Phases and explicitly set its status to Optional.

So I added

dependencies:
  - sdk: AppIntents.framework
    weak: true

to my XcodeGen configuration.

However, if I try to build the app with Xcode 13 as my colleagues will continue doing, I get Framework not found AppIntents error, that is solved my removing manually AppIntents.framework from Link Binary With Libraries.

I think this issue can be solved with a conditional statement in project spec file based on xcodebuild version. I am not sure, but maybe something like #1087.

alessionossa avatar Jul 18 '22 15:07 alessionossa