Xcode iOS build fail in Azure Devops Pipeline : Xcodebuild error code : 65

98 views Asked by At

I have been trying multiple things to solve this but I did not find any solution. There are multiple issues with this reference found on GitHub and stack flow and tried all solutions possible but still no luck.

2024-02-08T10:27:14.8788760Z ##[section]Starting: Package and sign app
==============================================================================
2024-02-08T10:27:14.8798760Z Task         : Xcode
2024-02-08T10:27:14.8798810Z Description  : Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
2024-02-08T10:27:14.8798910Z Version      : 5.231.5
2024-02-08T10:27:14.8798960Z Author       : Microsoft Corporation
2024-02-08T10:27:14.8799030Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/xcode
2024-02-08T10:27:14.8799120Z ==============================================================================
2024-02-08T10:27:15.1403720Z [command]/usr/bin/xcodebuild -version
2024-02-08T10:27:15.7854960Z Xcode 14.2
2024-02-08T10:27:15.7878830Z Build version 14C18
2024-02-08T10:27:15.7944210Z 
2024-02-08T10:27:15.8070230Z [command]/usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Runner.xcworkspace -scheme Runner archive -verbose CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=Apple Development: ISF V2 (V38NVFH6JB) PROVISIONING_PROFILE=d59e8400-1b31-4af1-83dc-9c14940e2d7e PROVISIONING_PROFILE_SPECIFIER=
2024-02-08T10:27:17.6211270Z Command line invocation:
2024-02-08T10:27:17.6226070Z     /Applications/Xcode_14.2.app/Contents/Developer/usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Runner.xcworkspace -scheme Runner archive -verbose CODE_SIGN_STYLE=Manual "CODE_SIGN_IDENTITY=Apple Development: ISF V2 (V38NVFH6JB)" PROVISIONING_PROFILE=d59e8400-1b31-4af1-83dc-9c14940e2d7e PROVISIONING_PROFILE_SPECIFIER=
2024-02-08T10:27:17.6280340Z 
2024-02-08T10:27:17.6281690Z User defaults from command line:
2024-02-08T10:27:17.6282260Z     IDEPackageSupportUseBuiltinSCM = YES
2024-02-08T10:27:17.6287770Z 
2024-02-08T10:27:17.6307490Z Build settings from command line:
2024-02-08T10:27:17.6308260Z     CODE_SIGN_IDENTITY = Apple Development: ISF V2 (V38NVFH6JB)
2024-02-08T10:27:17.6308870Z     CODE_SIGN_STYLE = Manual
2024-02-08T10:27:17.6309850Z     PROVISIONING_PROFILE = d59e8400-1b31-4af1-83dc-9c14940e2d7e
2024-02-08T10:27:17.6311260Z     PROVISIONING_PROFILE_SPECIFIER = 
2024-02-08T10:27:17.6311880Z     SDKROOT = iphoneos16.2
2024-02-08T10:27:17.6312590Z 
2024-02-08T10:27:19.3437920Z --- xcodebuild: WARNING: Using the first of multiple matching destinations:
2024-02-08T10:27:19.3438880Z { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
2024-02-08T10:27:19.3439460Z { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
2024-02-08T10:27:19.3440140Z { platform:iOS Simulator, id:2DE826BB-F234-4EC6-B812-45E930F78E0D, OS:16.2, name:iPad (9th generation) }
2024-02-08T10:27:19.3440660Z { platform:iOS Simulator, id:2F5C1283-BA66-41C0-A59A-F5E5D0701AE3, OS:16.2, name:iPad (10th generation) }
2024-02-08T10:27:19.3441240Z { platform:iOS Simulator, id:0D497416-F150-4C2D-897C-BF247AD7049E, OS:16.2, name:iPad Air (4th generation) }
2024-02-08T10:27:19.3441750Z { platform:iOS Simulator, id:FB1CB14D-0D29-49A3-8CB6-6E3F63CBDE28, OS:16.2, name:iPad Air (5th generation) }
2024-02-08T10:27:19.3442210Z { platform:iOS Simulator, id:98EE6CEC-5680-4628-BC77-217D808F6501, OS:16.2, name:iPad Pro (9.7-inch) }
2024-02-08T10:27:19.3442720Z { platform:iOS Simulator, id:58FBDD28-435D-4E02-A8DD-779C5DD21245, OS:16.2, name:iPad Pro (11-inch) (3rd generation) }
2024-02-08T10:27:19.3443180Z { platform:iOS Simulator, id:3BAB5B0E-F341-4F71-B3DA-8B32B134D4E6, OS:16.2, name:iPad Pro (11-inch) (4th generation) }
2024-02-08T10:27:19.3443650Z { platform:iOS Simulator, id:53420851-22C8-4CF9-B5B4-692618294222, OS:16.2, name:iPad Pro (12.9-inch) (5th generation) }
2024-02-08T10:27:19.3444100Z { platform:iOS Simulator, id:9CB64D8C-EE41-4A15-864C-3EA965EBF2D1, OS:16.2, name:iPad Pro (12.9-inch) (6th generation) }
2024-02-08T10:27:19.3445310Z { platform:iOS Simulator, id:805FD4D4-8FD0-48E5-9E22-5B6DCC5AD161, OS:16.2, name:iPad mini (6th generation) }
2024-02-08T10:27:19.3446730Z { platform:iOS Simulator, id:2878F110-0CFF-4C99-BCBF-E34AAC0EFF21, OS:16.2, name:iPhone 8 }
2024-02-08T10:27:19.3447170Z { platform:iOS Simulator, id:5DB205D4-3891-4F09-9930-B4F989C5B573, OS:16.2, name:iPhone 8 Plus }
2024-02-08T10:27:19.3447660Z { platform:iOS Simulator, id:821707CE-DBC9-452F-9FCE-0B1C34A6B67F, OS:16.2, name:iPhone 11 }
2024-02-08T10:27:19.3448070Z { platform:iOS Simulator, id:0144FA01-2C64-4FAF-A2AE-FA316C60978F, OS:16.2, name:iPhone 11 Pro }
2024-02-08T10:27:19.3448500Z { platform:iOS Simulator, id:686F16EE-AA33-478A-AC7A-D772901EE812, OS:16.2, name:iPhone 11 Pro Max }
2024-02-08T10:27:19.3448900Z { platform:iOS Simulator, id:282FE6EB-4F65-4902-A737-FEF201AC3E08, OS:16.2, name:iPhone 12 }
2024-02-08T10:27:19.3449380Z { platform:iOS Simulator, id:CDF937CE-B3D9-4977-9FB4-6A65AB40389C, OS:16.2, name:iPhone 12 Pro }
2024-02-08T10:27:19.3449810Z { platform:iOS Simulator, id:6FB3008C-661F-4CA9-9D92-0E0CA80F6991, OS:16.2, name:iPhone 12 Pro Max }
2024-02-08T10:27:19.3450310Z { platform:iOS Simulator, id:C5B6E977-0E33-44EA-8CAF-F30995133F26, OS:16.2, name:iPhone 12 mini }
2024-02-08T10:27:19.3450730Z { platform:iOS Simulator, id:AA5A47AF-561C-4C17-A6B0-6B49382E6D4B, OS:16.2, name:iPhone 13 }
2024-02-08T10:27:19.3451130Z { platform:iOS Simulator, id:3B52F876-FB30-4C28-A37C-31DF1FF2B93D, OS:16.2, name:iPhone 13 Pro }
2024-02-08T10:27:19.3451620Z { platform:iOS Simulator, id:E9F48511-23DA-46EB-A051-B6F4AB2AA235, OS:16.2, name:iPhone 13 Pro Max }
2024-02-08T10:27:19.3452030Z { platform:iOS Simulator, id:93AB6E6F-0F34-4538-B9C4-B7300DEB3722, OS:16.2, name:iPhone 13 mini }
2024-02-08T10:27:19.3452450Z { platform:iOS Simulator, id:15258FA7-886D-4BE8-86AF-97D404E74BC5, OS:16.2, name:iPhone 14 }
2024-02-08T10:27:19.3452850Z { platform:iOS Simulator, id:7A0F177C-7131-4B27-877D-BBC2F61D47E9, OS:16.2, name:iPhone 14 Plus }
2024-02-08T10:27:19.3453340Z { platform:iOS Simulator, id:D1B02D01-6FEB-4699-9605-5DA0A88648F7, OS:16.2, name:iPhone 14 Pro }
2024-02-08T10:27:19.3453780Z { platform:iOS Simulator, id:36F18E03-DAE1-4AAD-A7B5-20BFEFE0BCAF, OS:16.2, name:iPhone 14 Pro Max }
2024-02-08T10:27:19.3454210Z { platform:iOS Simulator, id:D253AE03-5078-49A8-9292-02DE0AAABE90, OS:16.2, name:iPhone SE (2nd generation) }
2024-02-08T10:27:19.3454800Z { platform:iOS Simulator, id:522B5589-DAFC-434A-B8CF-F761C6525C47, OS:16.2, name:iPhone SE (3rd generation) }
2024-02-08T10:27:19.3779630Z Prepare packages
2024-02-08T10:27:19.4338560Z 
2024-02-08T10:27:19.8434010Z note: Using codesigning identity override: Apple Development: ISF V2 (V38NVFH6JB)
2024-02-08T10:27:19.8722950Z Computing target dependency graph and provisioning inputs
2024-02-08T10:27:20.7414510Z 
2024-02-08T10:27:20.7744330Z Create build description
2024-02-08T10:27:23.9947660Z Build description signature: 3b5241b3cc152b82f991a57eec376d25
2024-02-08T10:27:23.9951500Z Build description path: /Users/runner/Library/Developer/Xcode/DerivedData/Runner-awafxxuvkqnxdxehheclpilzassv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/XCBuildData/3b5241b3cc152b82f991a57eec376d25-desc.xcbuild
2024-02-08T10:27:23.9952650Z 
2024-02-08T10:27:24.0467090Z note: Building targets in dependency order
2024-02-08T10:27:24.0523740Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/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 11.0 to 16.2.99. (in target 'FirebaseCoreInternal' from project 'Pods')
2024-02-08T10:27:24.0525640Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/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 11.0 to 16.2.99. (in target 'FirebaseCore' from project 'Pods')
2024-02-08T10:27:24.0528410Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/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 11.0 to 16.2.99. (in target 'FirebaseAnalytics' from project 'Pods')
2024-02-08T10:27:24.0530430Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Runner.xcodeproj: **error: Provisioning profile "ISF V2 2024" doesn't include signing certificate "Apple Development: ISF V2 (V38NVFH6JB)". (in target 'Runner' from project 'Runner')**
2024-02-08T10:27:24.0531800Z note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
2024-02-08T10:27:24.0533290Z note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
2024-02-08T10:27:24.0535300Z note: Run script build phase '[firebase_crashlytics] Crashlytics Upload Symbols' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
2024-02-08T10:27:24.0536560Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/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 11.0 to 16.2.99. (in target 'FirebaseInstallations' from project 'Pods')
2024-02-08T10:27:24.0537750Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/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 11.0 to 16.2.99. (in target 'FirebaseCoreExtension' from project 'Pods')
2024-02-08T10:27:24.0538970Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'PromisesSwift' from project 'Pods')
2024-02-08T10:27:24.0540130Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'PromisesObjC' from project 'Pods')
2024-02-08T10:27:24.0541950Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'nanopb' from project 'Pods')
2024-02-08T10:27:24.0543650Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleDataTransport' from project 'Pods')
2024-02-08T10:27:24.0545480Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/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 11.0 to 16.2.99. (in target 'GoogleAppMeasurement' from project 'Pods')
2024-02-08T10:27:24.0547020Z /Users/runner/work/1/s/ISFV2/ericsson_mobile_isf/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleUtilities' from project 'Pods')
2024-02-08T10:27:24.0584900Z ** ARCHIVE FAILED **
2024-02-08T10:27:24.0586820Z 
2024-02-08T10:27:24.0739770Z 
2024-02-08T10:27:24.1099230Z ##[error]Error: The process '/usr/bin/xcodebuild' failed with exit code 65
2024-02-08T10:27:24.1543990Z ##[section]Finishing: Package and sign app

My pod file:

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

My yaml file:

name: '1.0.$(Build.BuildId)'
resources:
  repositories:
  - repository: Arch_Skeleton_UI_Mobile
    type: git
    name: ISF-ARCH-SKELETON-LIB/Arch_Skeleton_UI_Mobile  # Replace with the actual name of your Azure DevOps repository
    ref: refs/heads/iOS_pipeline_komal
variables:
      scheme: 'Runner'
      sdk: 'iphoneos'
      configuration: 'Release'
      COCOAPODS_DISABLE_STATS: true
stages: 
  - stage: iOSStage
    pool:
      vmImage: 'macOS-latest'
    displayName: iOS
    jobs:
      - job: iOSJob
        displayName: iOS
        steps: 
          - checkout : Arch_Skeleton_UI_Mobile
          - task: InstallAppleCertificate@2
            displayName: Install Apple distribution certificate
            inputs:
              certSecureFile: 'Certificates.p12'
              certPwd: 'Ericsson@123'
              keychain: 'temp'
          - task: InstallAppleProvisioningProfile@1
            displayName: Install ad-hoc distribution profile
            inputs:
              provisioningProfileLocation: 'secureFiles'
              provProfileSecureFile: 'isf.mobileprovision'
  # - task: DownloadSecureFile@1
  #   displayName: Get GoogleService-Info.plist
  #   name: googleServicesInfoPlist
  #   inputs:
  #     secureFile: 'GoogleService-Info.plist'
  # - pwsh: Move-Item $(googleServicesInfoPlist.secureFilePath) ios/Runner/ -Force
  #   displayName: Override GoogleService-Info.plist
  
          - task: CopyFiles@2
            displayName: 'Copy Files to: $(Build.SourcesDirectory)/ios/Runner'
            inputs:
              SourceFolder: 'ISFV2/ericsson_mobile_isf/ios/Runner/'
              Contents: 'GoogleService-Info.plist'
              TargetFolder: '$(Build.SourcesDirectory)/ios/Runner'
          
          - task: Bash@3
            inputs:
              targetType: 'inline'
              script: |
                security find-identity -v -p codesigning
                                security find-certificate -a -Z -p -c "Apple Development: ISF V2 (V38NVFH6JB)"
                                #security cms -D -i isf.mobileprovision

          - task: Hey24sheep.flutter.flutter-install.FlutterInstall@0
            displayName: flutter install ios
            inputs:
                mode: 'auto'
                channel: 'stable'
                version: 'latest'
          - task: Hey24sheep.flutter.flutter-build.FlutterBuild@0
            displayName: buildios
            inputs:
              target: 'ios'
              projectDirectory: '$(System.DefaultWorkingDirectory)/ISFV2/ericsson_mobile_isf'
              iosCodesign: false

          - task: Xcode@5
            displayName: Package and sign app
            inputs:
              actions: 'archive'
              configuration: '$(configuration)'
              sdk: '$(sdk)'
              xcWorkspacePath: 'ISFV2/ericsson_mobile_isf/ios/Runner.xcworkspace'
              scheme: '$(scheme)'
              packageApp: true
              workingDirectory: 'ISFV2/ericsson_mobile_isf/ios'
              #exportPath: '$(System.ArtifactsDirectory)'
              exportOptions: 'auto'
              exportTeamId: 'EG2ML2NW5A'
              exportMethod: 'ad-hoc'
              archivePath: 'output/$(sdk)/$(configuration)/Runner.xcarchive'
              exportPath: 'output/$(sdk)/$(configuration)'
              useXcpretty: false
              args: '-verbose'
              #exportOptionsPlist: 'ISFV2/ericsson_mobile_isf/ios/ExportOptions.plist'
              signingOption: 'manual'
              signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
              provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
              teamId: 'EG2ML2NW5A'
          - task: PublishBuildArtifacts@1
            displayName: Publish artifact
            inputs:
              PathtoPublish: '$(System.ArtifactsDirectory)'
              ArtifactName: 'ios'
              publishLocation: 'Container'

References:

0

There are 0 answers