Search code examples
iosazure-devopsswift-package-manager

Build fails due to signing error for package added via SPM


After upgrading our Azure build CI pipeline from Xcode 12 to 14.2, the build has started to fail with the following error:

Package@swift-5.3.swift: error: Signing for "AppCenter_AppCenterDistribute" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'AppCenter_AppCenterDistribute' from project 'AppCenter')

This is the command that triggers the build:

xcodebuild -sdk iphoneos -configuration Release -workspace <project_name.xcworkspace> -scheme <target_name> build 
DSTROOT=<path/build.ds>
OBJROOT=<path/build.obj>
SYMROOT<path/build.sy> SHARED_PRECOMPS_DIR=<path/build.pch> -allowProvisioningUpdates -clonedSourcePackagesDirPath /Users/runner/work/1/s/temp "CODE_SIGN_IDENTITY=<identity_name>

AppCenter is a dependency added via SPM and does not have its own target in the project. The target builds and archives fine locally, it is just failing in the pipeline with the error above. I have double checked that all signing params (distribution, team, provisioning) are correct in both the pipeline and correctly set in the target in Xcode as well. Any ideas what could be the cause or how to fix please? Even if signing can be skipped that would be fine as this app is not distributed on the App Store.


Solution

  • This seems is a known issue with Xcode 14 as mentioned here. If you directly run the xcodebuild command in the pipeline, you can try to pass the argument "CODE_SIGN_STYLE=Manual" to the command.

    In Azure Pipelines, I recommend you use the built-in Xcode task to run the build. This task provides multiple signing styles.

    enter image description here

    1. If you select Manual signing (manual), you need to provide the following information on the task.

      • Signing identity
      • Provisioning profile UUID
      • Provisioning profile name
    2. If you select Project defaults (default), the task will use signing information has configured on your project.