This error generally occurs because the PackageApplication is lost after the Xcode upgrade. The PackageApplication file needs to be re-placed under /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/, you can download the PackageApplication Then cp the PackageApplication file to the corresponding location. If you directly use the cp command to copy the error of Permission denied, you need to use the following command
Password: ( Enter the local password to obtain root user privileges)
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
chmod +x /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication (add execution permission to PackageApplication)
After executing, you can rebuild
PackageApplication download address: https://pan.baidu.com/s/1mkhVxqxL0D2zagwyH0BkXA