I had the "Command SetOwnerAndGroup failed with a nonzero exit code" problem when creating an Archive and fixed it by removing both the Install Group and Install Owner in the target build deployment settings.
Select the app in Targets, select Build Settings and All and Combined. Scroll down to the Deployment section and remove the entries for Install Group and Install Owner.