I just had the same error, tried everything on Stackoverflow, Google and here with not luck.
I'm trying to use Apple Silicon to upgrade my app to universal but my old xcode app project was from old intel mac, and had an user defined setting VALID_ARCHS set to x86_64.
So my solution was to remove that VALID_ARCHS variable and it works perfectly.
My suggestion is to carefully and double check for possible conflicts in build settings, if you are having this problem due to upgrading from previous old xcode project.