skip to Main Content

Having trouble building a Flutter app targeting iOS. The issue came up out of the blue. The only big difference during the development cycle is the account owner had to accept new terms in the Apple Developer portal. A colleague can still build the app and publish to builds for TestFlight, but they were not actively developing during the time. It’s clearly a "me" problem.

Issue as reported during any sort of build:

Failed to codesign /ugly-path-to-app with identity REDACTEDABC123YOUANDME

Things I’ve tried that didn’t work.

  • cleaned the builds both via CLI and within xcode.
  • manually downloaded certificates
  • revoked and reissued certificates
  • rebooted
  • granted access to ALL (will be undoing this) to the keys within keychain.
  • hopped on one foot counter-clockwise while burning incense.

I don’t think the certificates or access them is the problem. Taking the identity REDACTEDABC123YOUANDME and exercising it on the command line with the following command works:

codesign --force --sign REDACTEDABC123YOUANDME test.txt

And there’s no keychain prompt. Running the command repeatedly tells me the file has been resigned and changing the identity to be something invalid, of course, fails.

At a loss here and short of trying to uninstall and reinstall xcode to fix this I don’t know what else to try.

In the title, but:

xcode 14.2
Flutter 3.7.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c07f788888 (4 months ago) • 2023-02-22 17:52:33 -0600
Engine • revision 0f359063c4
Tools • Dart 2.19.2 • DevTools 2.20.1

Flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):

[✓] Flutter (Channel stable, 3.7.5, on macOS 12.6.3 21G419 darwin-arm64, locale en-US)
[✓] Android toolchain – develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode – develop for iOS and macOS (Xcode 14.2)
[✓] Chrome – develop for the web
[✓] Android Studio (version 2022.1)
[✓] IntelliJ IDEA Community Edition (version 2023.1)
[✓] VS Code (version 1.79.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

I can provide more information as necessary, but as of now I’m somewhat stuck.

2

Answers


  1. Chosen as BEST ANSWER

    Ok, so 12 hours later it mostly righted itself. I performed the following steps both times but it worked the second, but I'll enumerate them here. If this helps someone, let me know and I'll accept my own answer. And if someone can either explain or confirm MacOS and XCode do some form of certificate caching I missed (would be the only thing that makes sense as the steps were the same).

    • Cleaned the build in Xcode
    • In XCode preferences, logged out of the Apple Developer Account
    • Exited xcode
    • Cleaned the build from the CLI running flutter clean.
    • Performed a step to negate the above actions and moved the project to a new directory (if it's in a folder called "project-name", the new folder is "project-name.old"
    • Deleted the DerivedData folder from Xcode (usually at rm -rf ~/Library/Developer/Xcode/DerivedData
    • Logged into the Developer console and revoked distribution and development certificaftes
    • Rebooted the computer
    • Created a folder for the project with the same name (because as most developers I didn't want to have to open it without going through Recently Opened, you can do as you wish).
    • Cloned the project into the new folder
    • In the project root, executed flutter pub get from the CLI.
    • Still in the CLI, changed to the ios directory and ran pod install.
    • Launched XCode
    • Went into XCode Preferences and logged into the developer account
    • Reissued certificates for the project.

    At this point, everything was probably fixed, but I ran the following steps again.

    • Went back to the CLI and built the project using flutter build ios --debug --flavor=Runner
    • After a successful build, went back to XCode, started the simulator, and connected launched the project with the simulator as project. Codesign worked here as well.
    • Changed to arm64 target and built an archive -- still works at this point.
    • Distributed the archive from Organizer up into Testflight
    • Success

    Now these are, again, the same steps I ran twice before and the only thing which makes sense, to me, is that there was some maintenance window at which I performed some specific action at exactly the wrong time that put me in this no-man's land. Of course, there's the other option that something else was going on entirely.

    Either way, I'm not a fan of stuff just starting to work so if anyone has any ideas please let me know what you believe them to be.

    And if this helps anyone, let me know that as well.


  2. Hi @andymeadowns this issue believe is related to this stack. I was having the same problem and fixed building the project on external disk without cloud backing up.

    https://stackoverflow.com/users/78429/andymeadows

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search