Cocoapods (AFNetworking) issue when archiving project

I am trying to build a legacy Obj-C project, it's getting around 80% of progress and fails with the following error. I tried to reinstall pods, clean Derived Data, restart Xcode/computer.

`mkdir -p /Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-cghzlwxuhadyvrehqungfijxixti/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/BuildProductsPath/Release-iphoneos/


rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" 

"../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AFNetworking.framework" "/Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-cghzlwxuhadyvrehqungfijxixti/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/"

building file list ... rsync: link_stat
 "/Users/myusername/myapp_ios/MyApp/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AFNetworking.framework" failed: No such file or directory (2)

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/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/ [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code`


  • You should be using outdated Cocoapods version, please consider updating to the latest one.

    As a temporary workaround, in your file you can change the following line:

    source="$(readlink "${source}")"


    source="$(readlink -f "${source}")"