For anyone still looking for this answer, it is because of code signing on an outdated XCode and/or MacOS. You need to upgrade to MacOS Big Sur and then update XCode to the latest version 12.5.1 (I was using 12.1 and on MacOS Catalina before).
Now to be fair, I haven't actually tested this solution just yet, but I saw many people saying this fixed their similar issue (and I noticed no one on here stated this answer).
Here is a link for the discussion I found the solution on:
https://developer.apple.com/forums/thread/682775