azure-pipelines-tasks: Xcode@5 Code Signing Error when building a project with embedded framework that does not support manual signing
Required Information
Type: Bug Task Name: Xcode@5
Environment
All
Issue Description
Xcode@5 fails to build an Xcode project that has multiple targets that have mixed signing needs, resulting in a Code Signing Error with this format:
<Framework> does not support provisioning profiles. <Framework> does not support provisioning profiles, but provisioning profile <Provisioning Profile Name> has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor.
In my case, I am trying to build an Xcode project produced by Unity 2019.3, which includes a new UnityFramework that does not support manual code signing.
According to the Unity Documentation, a new set of command line arguments for xcodebuild are to be used to target manual code signing to the main Unity-iPhone target only, and leave UnityFramework to be able to signed automatically.
Using PROVISIONING_PROFILE_APP and PROVISIONING_PROFILE_SPECIFIER_APP instead of PROVISIONING_PROFILE and PROVISIONING_PROFILE_SPECIFIER in the xcodebuild command fixes this issue.
Adding a “Custom Provisioning Profile Argument Suffix” parameter to Xcode under the Signing action would allow this issue to be fixed. See this blob post for more information about how the suffixes are used in building Xcode projects with multiple targets.
Here is a Unity produced Xcode project that can be used to demonstrate the issue:
You can attempt to build it using a command similar to this:
/usr/bin/xcodebuild -sdk iphoneos13.2 -configuration Release -project ./Unity-iPhone.xcodeproj -scheme Unity-iPhone archive CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY="<Code Sign Identity>" PROVISIONING_PROFILE_APP="<Provisioning Profile UUID>" PROVISIONING_PROFILE_SPECIFIER_APP="<Provisioning Profile Name>"
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 12
- Comments: 29 (2 by maintainers)
@pandey-laxman, sorry missed this email!
It needs to go in the arguments field in the Xcode task. This is how my Xcode task looks (in yaml):
Hi, @ericallam
The problem that you experience is specific for Unity Framework, our task is a more generic tool and we don’t plan to support specific frameworks like Unity. If it is required to build Unity Framework we could suggest you implement the task for this by yourself, which will consider Unity-specific features and options. Introducing any changes for support of specific frameworks in the existing Xcode task will make it more complex and also it would take effort to keep the task in sync with new framework versions. We don’t want to complicate the existing task structure by introducing framework-specific logic.
Although workarounds are described above, it would be nice is this issue would be fixed in this official repo. Are there any updates? Is this issue prioritized, and/or will it be?
For me,
CODE_SIGNING_ALLOWED=Noallowed my build to complete, but I couldn’t use the resulting app because it wasn’t signed. So, I don’t believe that’s a good solution.Edit: this did not end up being the final solution, see my new comment below for the full build script that uses separate archive/export archive steps.
Wish msft had more customer empathy with this kind of thing. Yes, this task isn’t specific to Unity, but it is specific to xcode, and Unity is a common framework to build in xcode. I agree it probably doesn’t warrant an implementation change on your side, but even mentioning something in your docs about how to work around this would be helpful because it is still an issue, rather than simply saying “not our problem”.
The original solution of using
PROVISIONING_PROFILE_APPandPROVISIONING_PROFILE_SPECIFIER_APPhere worked for me, and everything builds/signs successfully. I ended up just using a bash script because at the end of the day this task is really only useful for learning whatxcodebuildruns under the hood… because even passing manual args doesn’t work correctly as you can see above in some other replies.Here is the relevant section of the pipeline to show more explicitly how to work around this. See this doc on signing if you need context on how to use/setup the
InstallAppleCertificate@2andInstallAppleProvisioningProfile@1tasks.In this example, the variable
$(xcodeRoot)is set to$(Pipeline.Workspace)/sbecause in our case we aren’t cloning a repo in this job, we pull down the Unity xcode project files from a preceding job that runs on a windows VM, and manually put it in the dir where AzDo normally expects your repo root to be e.g./Users/runner/work/1/s/.Additionally, because we were building the xcode project files on a windows box, there is one other task we needed. There are two shell scripts in the xcode project root that were getting permission denied errors, so you can simply just add a bash task to chmod them first before running your
xcodebuildscript:Just a quick update, we tried your task and specified the suffix of APP, but it didn’t seem to make any difference to the build. I also tried it locally and couldn’t get xcodebuild to do anything with PROVISIONING_PROFILE_APP. It did the same as if it wasn’t specified.
Anyway, we found that using the original Xcode build task and specifying an argument of “CODE_SIGNING_ALLOWED=No” made it all build and sign correctly.
Thanks for you help.
The work around we used was to use a custom bash task that would execute all the commands that the xcode task would do, but with our own arguments.
You can find what all the commands are by observing the logs or outputs from the xcode task.
I am experiencing the same problem when upgrading from Unity 2018.4 to 2020.3 and it is a show stopper for automatic builds. A solution to this problem would be appreciated!