0

I’m trying to build and archive an iOS project in an Azure DevOps pipeline, but the build keeps failing with return code 65 when running the Xcode@5 task.

The project structure:

  • Root repo contains CI/CD config (azure-pipelines.yml)
  • iOS project (Core.xcworkspace) is a Swift native app that uses submodules
  • CocoaPods are used for dependency management

Here’s the relevant error snippet from the pipeline logs:

** ARCHIVE FAILED **

The following build commands failed:
    Archiving workspace NexoCore with scheme NexoCore
(1 failure)

##[error]Error: /usr/bin/xcodebuild failed with return code: 65

My pipeline YAML (relevant parts):

jobs:
  - job: ios
    pool:
      vmImage: 'macOS-latest'
    variables:
      configuration: "Release"
      sdk: "iphoneos"
      scheme: "Core"
      system.debug: true
      derivedData: "DerivedData"
      outputDir: "$(build.artifactStagingDirectory)"

    steps:
      - checkout: self
        submodules: recursive

      - script: |
          gem install cocoapods --no-document
          pod install --repo-update
        displayName: "Install CocoaPods"

      - task: InstallAppleCertificate@2
        inputs:
          certSecureFile: 'AppCetificate.p12'
          certPwd: $(appCertificatePassword)
          keychain: 'temp'
          deleteCert: true

      - task: InstallAppleProvisioningProfile@1
        inputs:
          provProfileSecureFile: 'IOSProvisioningProfile.mobileprovision'
          removeProfile: true

      - task: Xcode@5
        inputs:
          actions: 'clean archive'
          configuration: '$(configuration)'
          sdk: '$(sdk)'
          xcWorkspacePath: 'Core.xcworkspace'
          scheme: '$(scheme)'
          xcodeVersion: 'specifyPath'
          xcodeDeveloperDir: '/Applications/Xcode_16.4.app'
          packageApp: true
          signingOption: 'manual'
          signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
          provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
          args: '-derivedDataPath $(derivedData) -destination "generic/platform=iOS"'

What I’ve tried:

  • Verified the provisioning profile and certificate are uploaded correctly in DevOps
  • Confirmed that submodules are checked out (submodules: recursive)
  • Ran pod install with --repo-update to make sure Pods are up to date
  • Explicitly set Xcode version (/Applications/Xcode_16.4.app)
  • Used -destination "generic/platform=iOS"

Still, the archive step fails with code 65.

ERROR

I installed CocoaPods with pod install --repo-update, checked out submodules, and set up signing using certificate + provisioning profile tasks. I expected the Xcode@5 task to archive the workspace and generate an .ipa file, but instead it fails with xcodebuild return code 65 during the archive step.

ERROR LOG:

Build description path: /Users/runner/work/.../XCBuildData/abc.xcbuilddata

note: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'SomeLib' from project 'Pods')

/Users/runner/work/.../Pods/Pods.xcodeproj: error: Pods-ABC does not support provisioning profiles. 
Pods-ABC does not support provisioning profiles, but provisioning profile ABCProvisioningProfile has been manually specified. 
Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-ABC' from project 'Pods')

/Users/runner/work/.../SharedKit/SharedKit.xcodeproj: error: SharedKit does not support provisioning profiles. 
SharedKit does not support provisioning profiles, but provisioning profile ABCProvisioningProfile has been manually specified. 
Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'SharedKit' from project 'SharedKit')

/Users/runner/work/.../Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, 
but the range of supported deployment target versions is 12.0 to 18.5.99. (in target 'Alamofire' from project 'Pods')

** ARCHIVE FAILED **
The following build commands failed: Archiving workspace ABC with scheme ABC (1 failure)
4
  • You have to provide the full output of xcodebuild command so that we can help you. Commented Sep 16 at 12:36
  • I was able to build and upload the app to TestFlight locally without issues. But when I run the same process in Azure DevOps, it fails. Commented Sep 17 at 3:16
  • 1
    Turn on azure pipeline debug logs to true. I see you set it in the yaml, but add it to the pipeline in azure. There are normally more logs associated when debug logs are enabled and add —verbose flag to the task. Also review the full Xcode build command output that the pipeline spits out and try to run that locally instead. Between those two pieces I’m normally able to resolve the issues fairly quickly. Commented Sep 17 at 3:27
  • On my local machine, the provisioning profile shows as iOSTeamProvisioningProfile, and everything builds fine. In the pipeline, I’ve tried both approaches and both are failed: - Using a manual provisioning profile (ABCProvisioningProfile) with manual signing enabled - Switching entirely to automatic signing I have updated my question with the error log that occurred when I tried manual login. Commented Sep 17 at 7:27

1 Answer 1

0

Code 65 mostly happens due to code signing issues related certificates and provisioningProfiles.

In your Xcode@5 step try to use exportOptionsPlist with predefined ExportOptions.plist file like below. Get the export plist when you export the ipa after creating archive using xcode in local machine. You can add ExportOptions.plist in code and access with paths or in secure files.


   - task: Xcode@5
     displayName: 'Preparing Build'
     inputs:
        actions: 'build'
        configuration: '$(configurationOption)'
        sdk: '$(sdkOption)'
        xcWorkspacePath: '$(workspaceName)'
        scheme: '$(schemeName)'
        xcodeDeveloperDir: '/Applications/Xcode_16.4.app'
        packageApp: true
        signingOption: 'auto'
        args: '-verbose'
        exportOptionsPlist: "ExportOptions.plist"
        exportMethod: 'development' 
        exportOptions: 'plist'
        useXcpretty: true

Automatic Signing Example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>compileBitcode</key>
    <true/>
    <key>destination</key>
    <string>export</string>
    <key>method</key>
    <string>development</string>
    <key>signingStyle</key>
    <string>automatic</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>Team_ID</string>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
</dict>
</plist>

Manual Signing Example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>destination</key>
    <string>export</string>
    <key>manageAppVersionAndBuildNumber</key>
    <true/>
    <!-- Upload method -->
    <key>method</key>
    <string>app-store</string>
    <!-- Profiles Setup for all targets (Extensions)-->
    <key>provisioningProfiles</key>
    <dict>
        <key>com.***.ios</key>
        <string>Prod_com.***</string>
        <key>com.***.ios.Notification-Content</key>
        <string>Prod_com.***.ios.Notification-Content</string>
        <key>com.***.ios.Notification-Service</key>
        <string>Prod_com.***.ios.Notification-Service</string>
    </dict>
    <!-- Certificate-->
    <key>signingCertificate</key>
    <string>Apple Distribution</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <!-- Team Id-->
    <key>teamID</key>
    <string>Team_ID</string>
    <key>uploadSymbols</key>
    <true/>
</dict>
</plist>

If you are using CocoaPods and facing code signing issues, you can add a post_install script in your Podfile to disable code signing for all pods as shown below:

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
        config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
      end
    end
  end
end

Use -skipMacroValidation if you are using packages or macros.

Let me know if you are still facing issues.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.