I had this problem and this is what worked for me.
First off, let's just state the obvious, XCode was written to be the IDE version of the Tardis or maybe the Luggage from Terry Pratchett's Discworld series. It's bigger on the inside than it is on the outside and every time you open it you'll be shown something different.
Now, the root problem for me was that my Apple Developer sign in for my project needed to be refreshed. This is how I did that:
- Open your Flutter project in XCode.
- On top of the left panel there are some icons. One of them looks like a folder. If you hover over it, it will say "Show the Project navigator". Click that.
- On left panel below those icons select Runner (should be at the top of a list). This will populate the center panel.
- In the center panel, along the left-hand side, you should see a column with Project/Runner and Target/Runner. Select the Runner under Target. This will change the contents in the center panel right-hand side.
- Across the top you should now see the following options: General, Signing & Capabilities, Resource Tags, Info, Build Settings, Build Phases, and Build Rules. Select Signing & Capabilities.
- If you had the same problem as I had, you will now see prompt in the middle panel section asking you to sign in again and there will be a sign in button right there in the middle of the panel. Click it, sign in with your Apple Developer password.
- Now build your project again. You may be prompted by macos to login to grant keychain permissions during the build.
Hopefully this will help some other people.