Cant build in xcode

I can build to xcode without errors and publish to app store connect without problems. I can also play the game when building it to macOS (not through xcode). But when trying to play/build in xcode it doesn´t work and when using testflight then the app doesn´t start. (Manual signing)
Error that show in xcode (the one on top):
When using auto-signing another error appears (the two on the bottom):