iosfluttercodemagic

Codemagic - "Runner.app" requires a provisioning profile with the Push Notifications feature


I'm trying to set up codemagic ios flow. I want to build ipa and push it to TestFlight. I've created codemagic api key in AppStoreConnect, and created Developer & Distribution Certificates via Codemagic interface by Generating a new code signing certificate option. I also created a Provisioning profile for my app and it says that Push Notification Capability is enabled.

But when I start the process I have an error:

Encountered error while creating the IPA:
error: exportArchive: "Runner.app" requires a provisioning profile with the Push Notifications feature.

I'm new to codemagic and tried to do all steps by docs, but I can't understand this problem :( Maybe someone can help to fix the problem?

This is my flow:

ios-workflow-id:
    name: iOS Sample Workflow
    integrations:
      app_store_connect: CodeMagic
    environment:
      vars:
        APP_ID: #########
      ios_signing:
        provisioning_profiles:
          - Codemagic
        certificates:
          - Development_Certificate
          - Distribution_Certificate
    scripts:
      - name: Set up code signing settings on Xcode project
        script: |
          xcode-project use-profiles
      - name: Get Flutter packages
        script: |
          flutter packages pub get
      - name: Install pods
        script: |
          find . -name "Podfile" -execdir pod install \;
      - name: Flutter build ipa
        script: |
          BUILD_NUMBER=$(($(app-store-connect get-latest-app-store-build-number "$APP_ID") + 1))
          flutter build ipa --release \
            --build-name=1.0.0 \
            --build-number=$BUILD_NUMBER
    artifacts:
      - build/ios/ipa/*.ipa
    publishing:
      app_store_connect:
        auth: integration
        submit_to_testflight: true

Code signing logs:

Configure code signing settings
Searching for files matching /Users/builder/Library/MobileDevice/Provisioning Profiles/*.mobileprovision
Searching for files matching /Users/builder/Library/MobileDevice/Provisioning Profiles/*.provisionprofile
List available code signing certificates in keychain /Users/builder/Library/codemagic-cli-tools/keychains/03-02-23_smdje8o8.keychain-db
Searching for files matching /Users/builder/clone/**/*.xcodeproj
Completed configuring code signing settings
 - Using profile "Codemagic" [717112ed-c3ca-45b5-946a-efe6d07dffcc] for target "Runner" [Debug] from project "Runner"
 - Using profile "Codemagic" [717112ed-c3ca-45b5-946a-efe6d07dffcc] for target "Runner" [Profile] from project "Runner"
 - Using profile "Codemagic" [717112ed-c3ca-45b5-946a-efe6d07dffcc] for target "Runner" [Release] from project "Runner"
Generated options for exporting the project
 - Method: app-store
 - Provisioning Profiles:
     - com.fdforge.dev: Codemagic
 - Signing Certificate: Apple Distribution
 - Signing Style: manual
 - Team Id: #####
Saved export options to /Users/builder/export_options.plist

Solution

  • Fixed! I had to create export.plist file:

    <?xml version=“1.0” encoding=“UTF-8"?>
    <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
    <plist version=“1.0”>
    <dict>
        <key>compileBitcode</key>
        <true/>
        <key>method</key>
        <string>app-store</string>
        <key>provisioningProfiles</key>
        <dict>
            <key>com.example.appName</key>
            <string>Provisioning profile name</string>
        </dict>
        <key>signingCertificate</key>
        <string>iOS Distribution</string>
        <key>signingStyle</key>
        <string>manual</string>
        <key>stripSwiftSymbols</key>
        <true/>
        <key>teamID</key>
        <string>your team id</string>
        <key>thinning</key>
        <string>&lt;none&gt;</string>
    </dict>
    </plist>
    

    And changed the command for building IPA:

    - name: Flutter build ipa
            script: |
              flutter build ipa --export-options-plist=ios/export.plist --build-number=5 --build-name=1.0.0 --release
    

    And it works!)