6

I can't sign my Flutter project when archiving to ipa file on Azure Pipelines.

This is my build pipeline setup:

enter image description here

  1. Certificate get and built from Apple Developper program;
  2. Provisioning profile from Apple Developper program;
  3. The Flutter build script is a copy of this one (no signing);
  4. Launch of xcodebuild archive to get a signed ipa.

I tried manual signing and automatic signing.

With manual signing

    /usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace ..../ios/Runner.xcworkspace -scheme Runner archive CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=iPhone Distribution: My Name (MYTEAMID) PROVISIONING_PROFILE=guid-of-my-provisioning-profile PROVISIONING_PROFILE_SPECIFIER= | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color

## RESULT IS ERROR 65
    error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile com.blabla.myapp has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')
    error: shared_preferences does not support provisioning profiles. shared_preferences does not support provisioning profiles, but provisioning profile com.blabla.myapp has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'shared_preferences' from project 'Pods')

With Automatic signing

    /usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace .../ios/Runner.xcworkspace -scheme Runner archive CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=MYTEAMID | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color

## RESULT IS ERROR 65
    error: No profiles for 'com.blabla.myapp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.blabla.myapp'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')

With Automatic signing and -allowProvisioningUpdates

    /usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace .../ios/Runner.xcworkspace -scheme Runner archive -allowProvisioningUpdates CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=MYTEAMID | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color

## RESULT IS ERROR 65
    error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target 'Runner' from project 'Runner')
    error: No profiles for 'com.blabla.myapp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.blabla.myapp'. (in target 'Runner' from project 'Runner')

Any idea? And first, should I use Automatic or Manual signing?

EDIT 1

I tried with azure-pipelines.yaml found here and I still have the error:

Starting: Xcode archive and sign
==============================================================================
Task         : Xcode
Description  : Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
Version      : 5.151.2
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/xcode
==============================================================================
/usr/bin/xcodebuild -version
Xcode 11.1
Build version 11A1027
/usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace /Users/runner/runners/2.160.1/work/1/s/ios/Runner.xcworkspace -scheme Runner clean analyze archive -verbose CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=iPhone Distribution: XXXXXX (XXXXXXX) PROVISIONING_PROFILE=dd325087-6f6c-467b-93e2-a8c2446711e3 PROVISIONING_PROFILE_SPECIFIER=
Build settings from command line:
    CODE_SIGN_IDENTITY = iPhone Distribution: XXXXXX (XXXXXXX)
    CODE_SIGN_STYLE = Manual
    PROVISIONING_PROFILE = dd325087-6f6c-467b-93e2-a8c2446711e3
    PROVISIONING_PROFILE_SPECIFIER = 
    SDKROOT = iphoneos13.1

note: Using new build system

** CLEAN SUCCEEDED **

note: Using new build system
note: Planning build
note: Constructing build description
error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')
error: shared_preferences does not support provisioning profiles. shared_preferences does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'shared_preferences' from project 'Pods')

** ANALYZE FAILED **

note: Using new build system
note: Planning build
note: Constructing build description
error: shared_preferences does not support provisioning profiles. shared_preferences does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'shared_preferences' from project 'Pods')
error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile com.example.blabla has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')

** ARCHIVE FAILED **

PS

  • I can build and archive an a Macbook with Xcode ;
  • I can build and archive on AppCenter with this script (but all my other pipelines are on DevOps and I would like to keep one tool for CI/CD).

SOLUTION

As suggested by Levi, I edited the generated Podfile and forced a commit of it.

PS: no need to update install/uninstall cocoapods, package on Azure Pipelines is today on the latest version 1.8.4.

jootl
  • 699
  • 2
  • 8
  • 16

1 Answers1

5

You can use flutter install task and flutter build instead of to run the bash scripts. Check it here.

If your project needs cocoapods, you may need to add Cocoapods task to to your pipeline. Please check the example provided by Microsoft to learn more about how to build xcode apps.

For troubleshooting the profiles not fund error, you can check if the carthage lib was correctly configured into xcode projet. You can also try the solutions provided here.

Update:

For pods-runner not support error, Please try to add below to your pod file.

  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

And add below script to install the latest version cocoapods before building

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

For more information you can check this thread.

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • Thanks. I tried with the Flutter task but same problem. For Cocoapods, I added the task and force an update but Podfiles are generated by the flutter build so I cannot edit them. I will try on a borrowed Macbook (i'm currently on Windows) to first achieve this on a computer and after on CI/CD. – jootl Dec 06 '19 at 10:48
  • Hi @JTE How was it going with your local computer, Did you finially get it working on CI/CD? – Levi Lu-MSFT Dec 11 '19 at 06:26
  • Hi! I'm still stuck ‍♂️ I succeeded to archive throw Xcode on a MacBook but not on Azure Pipelines. I'm trying to use this example https://github.com/aloisdeniel/vsts-flutter-tasks/issues/28, but with error so far... Still investigating – jootl Dec 11 '19 at 08:05
  • For information, I downgraded Cocoapods to 1.5.3 and I got this error on flutter build task "CocoaPods minimum required version 1.6.0 or greater not installed". – jootl Dec 11 '19 at 13:45
  • Could you share the error message? when you implement the example in above GitHub link. For the release configuration you can refer to this [blog](https://www.appcoda.com/xcconfig-guide/). – Levi Lu-MSFT Dec 13 '19 at 09:04
  • Thanks for the link, I edited my post to add error message. – jootl Dec 13 '19 at 09:08
  • I updated above answer, Please have try adding the script to your pod file and install the latest pods. – Levi Lu-MSFT Dec 13 '19 at 09:47
  • Hello! Ok I tried with edited Podfile and it's worked. I Update my post. Thanks! – jootl Dec 20 '19 at 08:28
  • @LeviLu-MSFT Hey, I got he same error. Implementing your proposed fix, fixed my build, but now the app crashes at startup. See build and link source code here: https://dev.azure.com/florisdevreese/Flutter-CI-CD/_build/results?buildId=195&view=results. Have you any idea what's wrong? – Floris Devreese May 02 '20 at 11:53
  • Hello @FlorisDevreese! Did you try to build and start the app on MacOS with XCode? And if it helps, I just created a gist because I reworked all my pipeline https://gist.github.com/jterral/f2cb5dad022610c82bc4715420ed810e – jootl May 04 '20 at 14:53
  • 1
    Hi @JTE, I've just managed to get the app working :-D. I'm developing the app without `macOS` or `XCode`, so that is quite the challenge! The reason the app crashed was because it couldn't find `GoogleServices-Info.plist`. This was because that file wasn't added tot the targets. (Normally XCode askes to add that file to the targets). I've managed to manually edit the `project.pbxproj` file to add file to the targets. [See this change](https://github.com/FlorisDevreese/Flutter-CI-CD/commit/c2d5f4ad2c9a2a163cca110079a4b3467f9eb7a4#diff-38c5d0dde42025b924ea1bc746fb2cca). Now it works :-D – Floris Devreese May 04 '20 at 16:07
  • FYI: I'm planning to document this fix [in this repo](https://github.com/FlorisDevreese/Flutter-CI-CD) ;-) – Floris Devreese May 04 '20 at 16:10