Hey guys, new kid on the bloc here. I'm trying to learn Xcode/swift but when I'm trying to test my app on an iPhone device I get a generic error "command CodeSign failed with a nonzero exit code". After clean build folder I get this error "The specified item could not be found in the keychain." Indeed when I look in keychain there is no certificate. It's trying to create one but fails and goes in an endless loop. Using another Apple ID to test, has no issues, it's just my main Apple ID.
So to answer my own question. I don't know what fixed it, I just tried to create a project with User interface Storyboard and it worked the code got signed, and now when I created another project with User Interface: SwiftUI the code got signed. Not complaining it's fixed, but I spent 2 days with this, and I don't even know where I made a mistake or indeed if I made one.
This bragging about writing more code and do less debugging doesn't really stick Apple🤬🤬.