Thanks for your post. In my opinion and after to checking on Xcode myself, I think, these two errors are directly related and is because you don’t have a registered device? I could be wrong.
Please check first if your Apple Developer account currently has no devices registered to it, Xcode cannot generate the provisioning profile, which causes both of those errors. If not please plug your iPhone into your Mac using a cable. Unlock your iPhone. If prompted, tap the trust button to trust the computer and enter your passcode. In Xcode, look at the very top center of the window. Click it and change the destination from a Simulator to your physical iPhone. This step is important. Xcode won't try to register the device unless it is selected as the active build destination.
Go back to your project settings and select the Signing & Capabilities tab and check “Automatically manage signing" is checked and your team is selected. Because your physical iPhone is now selected as the build destination, Xcode should automatically attempt to register it. If a button appears that says "Register Device", click it. Xcode will communicate with Apple, add your iPhone's UDID to your developer account, and automatically generate the missing provisioning profile.
Make sure in the phone you select the Developer Mode. Toggle it on. Your iPhone will ask to restart. After it restarts, unlock it and confirm that you want to enable Developer Mode.
Let me know if it was not having a registered device. Thanks
Albert
Worldwide Developer Relations.