5

I'm trying to build and release my flutter app for development purposes (to test it with testmagic) with codemagic (because I'm using a windows machine). But everytime I build the app the step build fails and the following error shows up:

Unable to export archive: 2020-01-05 05:46:47.914 xcodebuild[1398:9643] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/r7/d9twdq011sb8d3q1p8f39cdr0000gn/T/Runner_2020-01-05_05-46-47.912.xcdistributionlogs'. error: exportArchive: App.framework does not support provisioning profiles. Error Domain=IDEProvisioningErrorDomain Code=10 "App.framework does not support provisioning profiles." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=App.framework does not support provisioning profiles., NSLocalizedRecoverySuggestion=App.framework does not support provisioning profiles, but provisioning profile {Name of the App + ID} has been manually specified. Remove this item from the "provisioningProfiles" dictionary in your Export Options property list.} ** EXPORT FAILED **

There's a part in the error message which says I should remove and item from the provisioningProfiles dictionary:

 Remove this item from the "provisioningProfiles" dictionary in your Export Options property list.

I don't understand what this means. I've tried with deleting the automatic generated provisioning profile from my apple developer account but this doesn't work.


The build settings:

codemagic build settings

The code signing settings:

codemagic code signing settings

I don't have any idea why this is happening. I found some github issues about a similar probelm on the internet but every issue is still open and not active or for xcode users and I'm not using xcode.

thmspl
  • 2,437
  • 3
  • 22
  • 48

3 Answers3

9

Old issue but I think this solution should apply to people who stumble upon this again. Usually this only affects users that are trying to build without a Mac and then they edit every instance of 'BundleIdentifier' they can find.

The fix is to open up your AppFrameworksInfo.plist file and change the CFBundleIdentifier to io.flutter.flutter.app instead of your bundle ID.

<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
Arnold Veltmann
  • 666
  • 5
  • 5
  • 1
    This my good sir has been a life saver. Have been banging my head the whole day trying to get things to build and this finally got it to work. Thanks ! – fixatd Mar 24 '21 at 16:09
1

It's not a direct answer to you question, but I managed to create a build pipeline for the Flutter Android & IOS app starter-template without the need for a physical macOS device.

All steps with the source code are documented here.

Hope this helps!

Floris Devreese
  • 3,127
  • 2
  • 21
  • 31
1

If you are using CI/CD (e.g Azure DevOpps) and passing xcodebuild command line build configuration arguments, e.g PRODUCT_BUNDLE_IDENTIFIER or PROVISIONING_PROFILE_SPECIFIER it will be also be passed downn to the other pods projects. As @arnold-veltmann said here the culprit is passing PRODUCT_BUNDLE_IDENTIFIER to projects (pods) that do not support signing. In my case it's for a project using Ionic 5 with Capacitor which make uses of cocoapods.

The usual post_install solution in pods file did not work for me

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

Although I did check and the post_install run and sets the build config correctly.

What I ended up doing was create a custom build setting e.g SP_PRODUCT_BUNDLE_IDENTIFIER and pass it in the azure devops yaml pipeline xcode build step

 - task: Xcode@5
    displayName: 'Build iOS app'
    inputs:
      actions: 'build'
      configuration: 'Appcenter'
      sdk: 'iphoneos'
      xcWorkspacePath: 'ios/App/App.xcworkspace'
      scheme: 'App'
      xcodeVersion: '11'
      packageApp: true
      archivePath: './output'
      exportPath: './output'
      exportOptions: 'plist'
      exportOptionsPlist: './_deploy/Appcenter-ExportOptions.plist'
      signingOption: 'default'
      args: SP_PRODUCT_BUNDLE_IDENTIFIER=$(bundleIdentifier) SP_PROVISIONING_PROFILE_SPECIFIER=$(iosProvisioningProfile)

Afterwards in the project.pbxproj I've located my build configuration used for Appcenter (CI/CD) build and set

E6D3FFF3256E6D8500109D05 /* Appcenter */ = {
            isa = XCBuildConfiguration;
            baseConfigurationReference = A158677F50F9AF6793C0B6F1 /* Pods-App.appcenter.xcconfig */;
            buildSettings = {
                ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
                CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
                CODE_SIGN_IDENTITY = "iPhone Distribution";
                CODE_SIGN_STYLE = Manual;
                DEVELOPMENT_TEAM = B982UY6B4T;
                INFOPLIST_FILE = App/Info.plist;
                IPHONEOS_DEPLOYMENT_TARGET = 12.0;
                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
                PRODUCT_BUNDLE_IDENTIFIER = "$(SP_PRODUCT_BUNDLE_IDENTIFIER)";
                PRODUCT_NAME = "$(TARGET_NAME)";
                PROVISIONING_PROFILE_SPECIFIER = "$(SP_PROVISIONING_PROFILE_SPECIFIER)";
                SWIFT_ACTIVE_COMPILATION_CONDITIONS = USE_PUSH;
                SWIFT_VERSION = 5.0;
                TARGETED_DEVICE_FAMILY = 1;
            };
            name = Appcenter;
        };

Notice the PROVISIONING_PROFILE_SPECIFIER = "$(SP_PROVISIONING_PROFILE_SPECIFIER)";

I hope this helps someone, because I spent 1 day, building a thousand times and failing 1001 more.

Narcis
  • 5,862
  • 3
  • 23
  • 30