Background#
Due to the upgrade of iOS to 16.4 on my phone, I wanted to do real device debugging, so I also upgraded Xcode to 14.3.
Before upgrading to Xcode 14.3, both Debug and Archive worked fine. After upgrading to Xcode 14.3, Debug still works fine, but Archive throws an error. The error message is as follows:
building file list ... rsync: link_stat "/Users/xxx/.../AFNetworking.framework" failed: No such file or directory (2)
done
sent 29 bytes received 20 bytes 98.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
Solution#
By searching for Xcode 14.3 Archive failure when running Cocoapods build script phase
, I found that there was already an issue with CocoaPods in Xcode 14.3 beta, and it turns out that the official version of Xcode 14.3 still has the same problem... The solution is as follows:
-
If Xcode 14.2 is still available on your computer, change the
Command Line Tools
to Xcode 14.2 for compilation, as shown in the following image: -
If there is a problem with Xcode Cloud, you can change the Xcode Version to Xcode 14.2, as shown in the following image:
-
If there is only one latest Xcode 14.3 on your computer, like mine... then you need to make the following modifications:
Find the ...-frameworks.sh file and replace
source="$(readlink "${source}")"
with
source="$(readlink -f "${source}")"
It's simple, right? The problem is, where is this ...-framework.sh? I don't know either.
The solution is: globally search for the segment
source="$(readlink "${source}")"
, and then replace it with the correctsource="$(readlink -f "${source}")"
. After that, you can compile it again and it will be successful.