Search code examples
iosflutterxcode

Error while building ios release after upgrading flutter,macOs and XCode version


I upgraded yesterday my macOS to 13.3.1 (22E261), and also to Xcode Version 14.3 (14E222b), and Flutter 3.7.12

Since the upgrade I am getting error while I try to build the ios app for release:

flutter build ios --release -t lib/main.dart

The error I get is as below

flutter build ios --release -t lib/main.dart
Building example.com for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: ******
Running Xcode build...                                                  
Xcode build done.                                            5.2s
Failed to build iOS app
Error (Xcode): No profiles for 'example.com' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'example.com'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass
-allowProvisioningUpdates to xcodebuild.
/Users/kristi.jorgji/Desktop/test/app/ios/Runner.xcodeproj



It appears that there was a problem signing your application prior to installation on the device.

Verify that the Bundle Identifier in your project is your signing id in Xcode
  open ios/Runner.xcworkspace

Also try selecting 'Product > Build' to fix the problem.
Encountered error while building for device.

What I tried to fix the issue:

  1. cd ~/Library/MobileDevice/Provisioning\ Profiles; rm *;
  2. XCode -> Settings -> Accounts -> Download Manual Profiles

Both the above did not work. I do see the provisionin profileenter image description here

Please give me some other ideas to solve this issue. I need to build and release on app store asap. Thanks


Solution

  • Ok I resolved the issue "magically" by doing in Xcode the following

    1. Product -> Build For -> Running
    2. After the build finished, I run again my commands in terminal flutter build ios --release -t lib/main.dart and after flutter build ipa --obfuscate --split-debug-info=build/app/outputs/symbols

    This time the build succeeded without complaining with the signature error anymore... I can finally upload the xarchive to AppStore.

    I still don't know why building in the xcode solved the issue though.

    Scenario 2: Certificate is removed from the keychain Another possible issue is the certificate can be removed from the keychain (in mac happens when you change the password).

    To fix this do the following:

    1. Xcode -> Settings -> Account -> Manage Certificates. You should see at least 1 certificate, and if it is not added in the keychain proceed to step 2
    2. We want to archive via xcode so they key is added into the keychain a)Choose "any ios device" enter image description here b) Product -> BuildFor -> Running c) Product -> Archive This will ask you to add the cert to the keychain

    That is all, issue should be fixed