I had the same problem, but I solved it by importing the "Provisioning Profile".
Steps
Check if the profile exists in "Certificates, Identifiers & Profiles" - "Profiles".
If it doesn't exist, register it and download the file.
Start Xcode and open "Signing & Capabilities".
Turn off "Automatically manage signing" and import the "Provisioning Profile".