XCode expects development certificate when trying to distribute app built on Flutter. ERROR ITMS-90161

212

So you have just stumbled upon this black hole that I've also stumbled upon before and the only steps that have helped me are the followings:

  1. Go to your development portal and remove all certificates and profiles.
  2. Go to your Keychain Access on your computer and remove all certificates (Create a backup before you do this. Put the backup in a ZIP file)./
  3. Go to Xcode and in your project remove all settings related to profiles and certificates by selecting them and then pressing Backspace.
  4. Delete all provisioning profiles on your computer under this folder ~/Library/MobileDevice/Provisioning Profiles/
  5. Generate a new certificate request in Keychain Access.
  6. In Developer Portal, create a new Distribution certificate using your certificate request.
  7. Download the newly-generated certificate and double click to install it in your Keychain Access.
  8. In Developer Portal, create a new App Store profile for your newly generated certificate and download it.
  9. After downloading the profile, manually place it in the ~/Library/MobileDevice/Provisioning Profiles/ folder. If you double click on a provisioning profile to install it, it loses its actual name and changes the name to its UUID making it undistinguishable from other profiles. So manually place the downloaded profile in ~/Library/MobileDevice/Provisioning Profiles/
  10. Quit Xcode completely
  11. Go back to Xcode and set up your profiles and certificates and make sure you're not doing automatic signing
  12. Clean your Xcode project
  13. Build again and you should be good to go
Share:
212
Ashwin
Author by

Ashwin

Updated on January 04, 2023

Comments

  • Ashwin
    Ashwin over 1 year

    XCode expects a development certificate with my provisioning profile when I am actually trying to do a distribution.

    More details

    I am trying to push an update to an iOS app on app store, that was initially built by another developer using Flutter. Using flutter build ipa and uploading the archive through XCode simply never worked, it always got stuck in the uploading screen. So I tried Transporter after getting an ipa with flutter build ios --release [1]. Using automatic signing so far, Out of almost 50 tries, only one went through for some reason. The rest of the time I see the following error.

    ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle com.spoonmoney.app [Payload/Runner.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal." 
    

    Transporter error while uploading Transporter Details of automatic signing Automating signing includes development certificate

    When I try to do manual signing with a valid provisioning profile which includes distribution cert, Xcode shows this error:

    Manual signing error Details of profile enter image description here

    Things to note

    • I tried clearing relevant certificates and profiles both from my Keychain access and developer profile and created new ones. No improvement.
    • Tried clearing signing certificates in Flutter flutter config --clear-ios-signing-cert
    • I have an active developer program membership.
  • Ashwin
    Ashwin about 2 years
    Could you please elaborate on point 3
  • Vandad Nahavandipoor
    Vandad Nahavandipoor about 2 years
    Yes sure. Open your Xcode workspace and then go to your project on top left, then go into build settings and find "profile", select all profile related settings and press the backspace key on your keyboard to delete those settings. Do the same thing for the search term "Certificate" and also for "Code Signing Identity" and delete all those settings.
  • Ashwin
    Ashwin about 2 years
    Thanks a lot for the explanation. Unfortunately, even after following all the steps, I faced the same issue. But weirdly, I tried using XCode's archive uploader instead of Transporter. It asked me to manually select the distribution profile while uploading and it went through!
  • Vandad Nahavandipoor
    Vandad Nahavandipoor about 2 years
    Glad to hear that, yes Xcode, during uploading to App Store, always asks for profiles.