How to fix ' *pod* does not support provisioning profiles' in azure devops build agent
Asked Answered
B

2

18

I currently have problem with my pipeline in Azure Devops. Since March 27th, I got the error:

error: Alamofire does not support provisioning profiles. Alamofire does not support provisioning profiles, but provisioning profile prov profile name has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Alamofire')

I have this error for all my pods.

The code: The exact same branch have built correctly the day before.

Xcode version: I know the agent is still on Xcode 10.1 and I haven't update my project to 10.2 so it should be good.

Provisioning profiles: Is valid.

Suspicion : Apple released a new version of Xcode and Swift on this day. Microsoft also update Agents on this day: github.com/Microsoft/azure-pipelines-tasks/commit/1b019b9f65202d65ac58150bff6514938b53ff78#diff-93b5db3773bba1013dce9d814869dffd

Soooo, anyone have an idea? What is wrong with my pipeline ?

Birecree answered 29/3, 2019 at 14:46 Comment(4)
Can you provide the actual relevant code?Andrewandrewes
Error: /usr/bin/xcodebuild failed with return code: 65Birecree
did you ever figure it out?Berberidaceous
Can you please mark my answer as the correct answer?Octahedron
O
44

The issue is that the newest version of Cocoapods is trying to sign the frameworks.

Add the following code to your podfile

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
            config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
            config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
    end
end
Octahedron answered 18/4, 2019 at 17:11 Comment(7)
I've tried this then $pod install again, and commit new src but it's still not working. My pods are all in repo.Vermiculite
Thanks you saved me a lot of time!Whitson
Works! This should be marked as answer and highlighted in the community. This answer has helped me fix hours of struggle.Mussman
Anyone know the right place to put this in an Ionic app by chance?Indwell
@Octahedron anyone one know how does it work with ionic app?Hissing
I specified CODE_SIGNING_ALLOWED=No arguments in xcode task and it worked, but now I am getting error while uploading the ipa file to app store. ERROR ITMS-90174: "Missing Provisioning Profile - Apps must contain a provisioning profile in a file named embedded.mobileprovision."Hissing
it worked for me. thanks :)Strati
O
0

For anyone working with NativeScript and macOS-11, I found that you can't uninstall cocoapods and downgrade it to a lower version. So you need to go the approach of updating the Podfile. The Podfile isn't provisioned until after you run a build at least once, so you need to build, replace with your own, then build again.

Azure Pipeline

pool:
  vmImage: 'macOS-11'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '12.16.1'
  displayName: 'Install Node.js'

- task: DownloadSecureFile@1
  name: releaseJksFile
  displayName: 'download android keystore file'
  inputs:
    secureFile: 'release.jks'

- task: InstallAppleCertificate@2
  inputs:
    certSecureFile: AppleCertificate.p12
    certPwd: $(AppleCertificatePassword)
    keychain: 'temp'
    deleteCert: true
  displayName: Install Apple Certificate

- task: InstallAppleProvisioningProfile@1
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'AppleReleaseProfile.mobileprovision'
    removeProfile: true
  displayName: 'Install Apple Provisioning Profile'

# Optional... was running into build issues with latest version
#downgrading cocoapods version
- script: |
    $ANDROID_HOME/tools/bin/sdkmanager --uninstall 'build-tools;31.0.0'
  displayName: 'Remove Android 31 SDK' 

- script: |
    pip install six
    npm install -g @angular/cli nativescript
    tns clean
    npm install
    mkdir $(Build.ArtifactStagingDirectory)/android
    mkdir $(Build.ArtifactStagingDirectory)/iphoneos
    sed -i -e 's/1.00000000.00/1.$(Build.BuildNumber)/g' App_Resources/iOS/Info.plist
    sed -i -e 's/1000000/10$(Build.BuildId)/g' App_Resources/Android/src/main/AndroidManifest.xml
    sed -i -e 's/1.00000000.00/1.$(Build.BuildNumber)/g' App_Resources/Android/src/main/AndroidManifest.xml
    tns build android --env.production --release --key-store-path '$(releaseJksFile.secureFilePath)' --key-store-password '$(KeyStorePassword)' --key-store-alias '$(KeyAlias)' --key-store-alias-password '$(KeyPassword)' --bundle 
    cp -rf "platforms/android/app/build/outputs/apk/release/" "$(Build.ArtifactStagingDirectory)/android"

    echo "uninstalling all cocoapods versions"
    sudo gem uninstall cocoapods -ax
    echo "installing cocoapods version latest"
    sudo gem install cocoapods
    tns run ios --provision     #see what provisioning profile and certificate are installed... helpful for debugging
    tns build ios #creates podfile we are going to replace
    cp -rf Podfile platforms/ios/Podfile
    rm platforms/ios/Podfile.lock
    cd platforms/ios
    pod install
    cd ../../
    tns build ios --env.production --release --bundle    #creates xcworkspace
  displayName: 'Setup/Build'

- task: Xcode@5
  inputs:
    actions: 'build'
    scheme: 's'
    sdk: 'iphoneos'
    configuration: 'Release'
    exportPath: '$(Build.ArtifactStagingDirectory)/iphoneos/'
    packageApp: true
    xcWorkspacePath: 'platforms/ios/s.xcworkspace'
    xcodeVersion: 'default' # Options: 8, 9, 10, default, specifyPath
    signingOption: 'manual'
    signingIdentity: '$(AppleCertificateSigningIdentity)'
    provisioningProfileUuid: '$(AppleProvisioningProfileUuid)'

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(Build.ArtifactStagingDirectory)' 
    artifactName: 'drop'

Podfile (place at the root of project dir)

use_frameworks!

target "s" do
# Begin Podfile - /Users/runner/work/1/s/node_modules/@nativescript/secure-storage/platforms/ios/Podfile
pod 'SAMKeychain', '~> 1.5.3'
# End Podfile

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

# Begin Podfile - /Users/runner/work/1/s/platforms/ios/Podfile-exclusions
def post_installNativeScript_CLI_Architecture_Exclusions_0 (installer)
  installer.pods_project.build_configurations.each do |config|
    config.build_settings.delete "VALID_ARCHS"
    config.build_settings["EXCLUDED_ARCHS_x86_64"] = "arm64 arm64e"
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386 armv6 armv7 armv7s armv8 $(EXCLUDED_ARCHS_$(NATIVE_ARCH_64_BIT))"
    config.build_settings["EXCLUDED_ARCHS[sdk=iphoneos*]"] = "i386 armv6 armv7 armv7s armv8 x86_64"
  end
end
# End Podfile
end
Orchard answered 12/11, 2021 at 20:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.