azure-pipelines-tasks: Xcode builds suddenly failing with message 'error: does not support provisioning profiles

Question, Bug, or Feature?
Type: Bug

Enter Task Name: Xcode@5

Environment

  • Azure Pipelines
  • Hosted Agent

Issue Description

iOS Swift app with some external CocoaPods dependencies. Built fine for weeks, since March 28th (CET) suddenly failing with error code 65.

error: <podname> does not support provisioning profiles. <podname> does not support provisioning profiles but provisioning profile <distrprofile> has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target '<podname>')

Changing provisioning mode to “Automatic” doesn’t resolve it as suggested.

Builds that passed on or before March 27th are now failing when resubmitted. image

Update to task-lib 2.8.0 in tasks using iOS signing and secure files was merged to master on the 27th. Coincidence?

Error logs

https://developercommunity.visualstudio.com/content/problem/508973/xcode-builds-suddenly-failing-with-message-error-d.html

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 24 (4 by maintainers)

Most upvoted comments

Found a solution to our project. First, ensure you pod file has the following post-install section:

platform :ios, '9.0'

# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

#--- This was what we had missing ---
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


target <your project> do
  <your pods>
end

Next we used the latest cocoapods version which worked (1.7.0.beta.3). So have this as a script before the build process:

echo "uninstalling all cocoapods versions"
sudo gem uninstall cocoapods -ax
echo "installing cocoapods version latest"
sudo gem install cocoapods --pre

We’re investigating whether this could be caused by rolling out the latest version of CocoaPods last week. We’re trying to reproduce the error. Can someone please run this script as part of their pipeline to see if rolling back to a previous version of CocoaPods patches the problem?

echo "uninstalling all cocoapods versions"
sudo gem uninstall cocoapods -ax
echo "installing cocoapods version 1.5.3"
sudo gem install cocoapods -v 1.5.3

Thanks for reporting this @christoferlof. You reached the right people and we’re investigating ASAP.

@hugo-retro Your solution helped me solve same issue on an Ionic iOS build created from Azure Build Pipelines

The update to the task-lib 2.8.0 hasn’t deployed yet, so that is unrelated. We are investigating. Thanks for reporting the issue.

Thanks everyone for the helpful code excerpts.

I wanted to modify the Podfile during the build. In order to make the changes @hugo-retro noted, I’ve used the script below (thank you @LozanoMatheus for your patience in explaining the intricacies of echo 🙌 ). I’ve added this as a bash script step, just before pod install.

podfile_path='$(System.ArtifactsDirectory)/build-artifacts/ios/App/Podfile' # You probably want to adjust this

install_line=$(grep -Fn 'install!' $podfile_path | cut -d: -f 1)
insert_at_line=$(( $install_line + 1))

part_1=$(cat $podfile_path | tail -n +1 | head -n $(($install_line)) )
part_3=$(cat $podfile_path | tail -n +$(($insert_at_line+1)) )

# https://github.com/Microsoft/azure-pipelines-tasks/issues/9984#issuecomment-483968562
part_2="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"

echo "$part_1" > $podfile_path
echo -e "\n#BEGIN - Inserted during the pipeline:\n" >> $podfile_path
echo "$part_2" >> $podfile_path
echo -e "\n#END - Inserted during the pipeline:\n" >> $podfile_path
echo "$part_3" >> $podfile_path

I changed the script to make sure already existing post_install entries will be kept:

#!/bin/bash

podfile_path="Podfile"
temp_podfile_path="Podfile.tmp"

inside_post_install=0

while IFS= read -r line; do
  if [[ "$line" == "post_install do |installer|" ]]; then
    inside_post_install=1
  fi

  if [[ "$inside_post_install" -eq 1 && "$line" == "end" ]]; then
    echo "  # Inserted during the pipeline"
    echo "  installer.pods_project.targets.each do |target|"
    echo "    target.build_configurations.each do |config|"
    echo "      config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = \"\""
    echo "      config.build_settings['CODE_SIGNING_REQUIRED'] = \"NO\""
    echo "      config.build_settings['CODE_SIGNING_ALLOWED'] = \"NO\""
    echo "    end"
    echo "  end"
    echo "  # End of inserted block"
    inside_post_install=0
  fi

  echo "$line"
done < "$podfile_path" > "$temp_podfile_path"

mv "$temp_podfile_path" "$podfile_path"

Personally? Turn off Flutter.

Thanks for the solution. I updated my Podfile with the content provided by you but I am getting this error now.

Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/flutter_tools.Fi5lKu/flutter_ios_build_temp_dirScZJa1/temporary_xcresult_bundle

    In file included from /Users/runner/hostedtoolcache/Flutter/2.10.2-stable/macos/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.m:5:
    /Users/runner/hostedtoolcache/Flutter/2.10.2-stable/macos/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/JavaScriptChannelHandler.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.

@DavidStaheli we were struggling with this since the beggining of the month, now everything is green again ✔. Thanks a lot.

@DavidStaheli Hi, I have just tried to rolling back to 1.5.3 version of CocoaPods as you requested and seems it solved the issue in my pipeline.