Archive Failing in Xcode 14.3 update While using CocoaPods – Xcode

by
Ali Hasan
axios cocoapods swift-concurrency xcode xcode14.3

Quick Fix: Update CocoaPods to version 1.12.1 or later. After updating CocoaPods, update your pods in the Xcode project. If the issue persists, try removing existing CocoaPods integrations (pod deintegrate) and re-installing them (pod install).

The Problem:

An Xcode 14.3 update is causing an error when archiving a project using the rsync command. The error message reads, "rsync: link_stat "/[APP_PATH]../../../ IntermediateBuildFilesPath/UngetProducts/ iphoneos/Alamofire.framework" failed: No such file or directory (2)", indicating that a file is missing during the build process. The issue occurs when using the bundled version of the rsync command in Xcode, but not when using the package manager to install the same project. Further investigation reveals that the issue might stem from a specific version of the Moya pod. Users are seeking a solution to fix this archiving error effectively so they can continue their development process.

The Solutions:

Solution 1: Update CocoaPods and Podfile

This issue has been resolved in CocoaPods version 1.12.1. To fix the problem:

  1. Update CocoaPods to version 1.12.1 or later.
  2. Update the Podfile:
    • Ensure that the platform line is set to the correct iOS version, such as platform :ios, '13.0'.
    • Update the pod dependencies to the latest versions, if necessary.
  3. Run pod deintegrate to remove the existing CocoaPods installation.
  4. Run pod install to reinstall CocoaPods and update the project dependencies.

Solution 2: Correcting Deployment Target for iOS 11 Compatibility

Step 1: Adjust Podfile Configuration

Add the following code to your Podfile to set the iOS deployment target to an earlier version, such as iOS 11:

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
      end
    end
  end
end

Step 2: Reinstall Pods

Run the following commands to reinstall your CocoaPods:

pod deintegrate
pod install

Step 3: Update Pod Framework Script (Optional)

For Firebase Crashlytics users, if you encounter a problem with the order of Build Phases, perform the following steps:

  1. Open the file ‘Pods-[Your App Name]-frameworks.sh’ located in your project folder.
  2. Find the code source="$(readlink "${source}")".
  3. Insert ‘-f’ to the above code like source="$(readlink -f "${source}")".

Step 4: Ensure Firebase Crashlytics Order

Move the ‘Firebase Crashlytics’ shell command to the end of the order in the ‘Build Phases’ panel under ‘Targets > [Your App Name]’.

Solution

To resolve the error and successfully archive your project using Xcode while utilizing CocoaPods, follow these steps:

  1. Update CocoaPods: Ensure you have the latest version of CocoaPods installed by running the following command:
sudo gem install cocoapods
  1. Add Post-Install Script to Podfile:

    • Open your Podfile and add the following post-install script:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        # Fix library not found issue
        target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
        end
      end
    end
    
  2. Re-install CocoaPods: Run the following command to re-install CocoaPods and update your project:

    pod install
    
  3. Clean and Archive: Clean your Xcode project (Product > Clean) and then attempt to archive it (Product > Archive).

These steps should resolve the error you were encountering and allow you to successfully archive your project using CocoaPods.

Q&A

CocoaPods 1.12.0 is not working with the latest Xcode 14.3 version.

This issue has been fixed in version 1.12.1 of the cocoapods. Please update the version and update the pods in the project.

How to fix this error — rsync error: some files could not be transferred (code 23)?

This error can be fixed by modifying the value of IPHONEOS_DEPLYMENT_TARGET to ‘11.0’ or higher depending on your app requirement.

In Xcode 14.3, why am I facing the libarclite_xxxxx.a file not found error when archiving my project with Cocoapods 1.12.1 and Xcode 14.3 ?

You can solve this issue by adding the below code in your Podfile and re-run pod install command.

Video Explanation:

The following video, titled "Xcode Command PhaseScriptExecution failed with a nonzero exit ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

XCode Error PhaseScriptExecution failed with a nonzero exit code when you update from 14.2 to 14.3. ABC's of AI•7K views · 1:22:35 · Go to ...