Swift Packages and Automatic Signing

Is there currently a way to change code signing from Automatic to Manual for remote Swift packages in iOS builds with Unity Build Automation?

With the deprecation of Cocoapods, libraries such as Firebase are moving over to Swift packages instead. Unity updates all targets in the Xcode project to use manual signing in a fastlane step, before building with gym. This works for targets in pods, however targets in Swift packages can’t be updated in the same way before building, causing errors such as this:

/BUILD_PATH/Library/Developer/Xcode/DerivedData/Unity-iPhone-brovzeypbjhftbhdfulmghmumktu/SourcePackages/checkouts/firebase-ios-sdk/Package.swift: error: Signing for "Firebase_FirebaseMessaging" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'Firebase_FirebaseMessaging' from project 'Firebase')

I reproduced the issue locally, and recreated UBA’s Fastfile steps as best as I could based on the build logs. The only way I could build successfully was by passing CODE_SIGN_STYLE=Manual with the xcargs during the build step. This seems to be the solution others use too when using SPM in their own CI, or in non-Unity projects.

Is there a way to set this in UBA without the custom xcargs being overwritten by the gym_options that’s being passed into the gym call? How are those options constructed? Would there be any downside to Unity passing in CODE_SIGN_STYLE=Manual by default, along with the other argument currently used? (-UseModernBuildSystem=YES)

I’ve reverted to using the Firebase pods instead in the meantime, but I’d like to fix this before it’s fully deprecated later this year - and avoid the need to modify the Firebase package each update.

We’re facing the same problem, and you were the first to mention it. I’d also like to request that UBA automatically handle this issue.

Unity support created this guide on how to resolve this issue, but it seems more like a temporary fix than a definitive one.
BUT! The Unity support fix breaks the Game Center compatibility, so I don’t recoment it COMPLETELY. Instead, create a Gymfile with this content:
xcargs("CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM=<TEAM_ID>")
https://support.unity.com/hc/en-us/articles/49226709597332-iOS-UBA-builds-fail-with-Xcode-signing-errors-for-Firebase-GoogleUtilities-SPM-targets

Have you received any response from Unity about this through any other channel?

Or have you found any other way to make this work that you could share?

Also, is it possible to add the iOS tag to this discussion so that it appears to other iOS developers?

Thank you in advance.

Hi @unityventures40 thank you for pointing out this possible side effect.

We appreciate you sharing your findings and workaround. We’re going to review this feedback internally, especially the concern about potential impact on Game Center compatibility, and evaluate whether the article should be updated to better reflect these considerations.

We’ll also escalate this case to our engineering team so they can investigate whether a more definitive solution is needed for Swift Package signing in iOS builds with UBA, instead of relying only on workarounds.

As soon as I have any updates to share, I’ll post them here in this same forum thread.

Thanks again for raising this.

Mauro