How to force Flutter to use new developer certificate?

Viewed 6611

I am currently developing an application with Flutter. I used to be able to run the code directly using VS code or the command flutter run. Ever since I revoked my developer certificate and generated a new one, the above options when executed, the app crashes on my iPhone. If, however, I run it on the simulator, it works as expected.

I suspect that this is due to the change in certificates. Xcode says my app is signed with the certificate B39****** where as flutter run says it is signing with 578*******

I have even tried flutter config --clear-ios-signing-cert as well as flutter upgrade and it still signs with 578.

How can I force flutter to sign my app with the new certificate? Currently, this means I cannot use the hot reload feature on my physical devices.

7 Answers

Run flutter config to see your current settings and a certificate choice applied.

To clear the choice according to the documentation you can run:

flutter config --clear-ios-signing-cert.

--clear-ios-signing-cert Clear the saved development certificate choice used to sign apps for iOS device deployment.

Flutter 2.0.5.

I think check this file vim ~/.flutter_settings will be well.

{
  "ios-signing-cert": "Apple Development: XXXX@gmail.com (XXXXXXXX)",
  "enable-macos-desktop": true
}

I had a very similar issue a couple months ago. It took me several hours and basically I had to sign out of and then sign back into XCode:

XCode->Preferences->Accounts

Completely sign out of any accounts and then sign back in with the newest one.

Use

flutter clean

in the terminal. When will clear the selected certificate and will present a choice to you next time you run you code

I just fixed it by going into Xcode and setting the correct team. I think perhaps Flutter does have a saved file somewhere with these old default c

I was trying to change the default one that gets used as I create a new project, here's what worked for me: 1-Removing old certificate from keychain access 2-Adding new one 3-Restarting terminal session and creating a new project

ps: other steps that might be needed as well: Sign out of old account on Xcode and sign in with the new one

In code sign page of Xcode. There is sub pages, with tab: All, Debug, Release and Profile. It takes me several days to figure out I have selected the wrong develop team. And then takes me few hours to find out that I have somehow clicked the Profile tab, instead of All.

I guess you have the same problem.

Related