Search code examples
iosreact-nativeexpoeas

EAS build - rsync error: some files could not be transferred (code 23) error


When creating an iOS EAS build, I get the following error during the Run Fastlane step:

› Executing MyApp » [CP] Embed Pods Frameworks

❌  rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]

So after some research, I got the following answers which are somewhat related (those were answered for flutter/ionic though),

  1. https://forum.ionicframework.com/t/fixed-xcode-14-3-doesnt-work-building-operations-fail-fixed/232239/2, &

  2. rsync error: some files could not be transferred (code 23) Command PhaseScriptExecution failed with a nonzero exit code

I think it is due to new cocoapods and Xcode v14.3, but as i'm using EAS for building my iOS app and not on local machine, I cannot just update the cocoapods on my local machine, as all the build process is taking place in EAS server, so how can I solve this issue particularly when using eas build.

package.json:

"expo": "^46.0.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.6",

Podfile:

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

production = ENV["PRODUCTION"] == "1"

require 'json'
podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}


target 'MyApp' do
  use_expo_modules!
    post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
  config = use_native_modules!
  config = use_frameworks!
  # use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true

  # Flags change depending on the env values.
  flags = get_default_flags()

  pod 'expo-dev-launcher', path: '../node_modules/expo-dev-launcher', :configurations => :dev
  pod 'expo-dev-menu', path: '../node_modules/expo-dev-menu', :configurations => :dev

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes',
    :production => production,
    # :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    :flipper_configuration => FlipperConfiguration.disabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # Workaround `Cycle inside FBReactNativeSpec` error for react-native 0.64
    # Reference: https://github.com/software-mansion/react-native-screens/issues/842#issuecomment-812543933
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'NO'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end

      if (target.name&.eql?('FBReactNativeSpec'))
        target.build_phases.each do |build_phase|
          if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
            target.build_phases.move(build_phase, 0)
          end
        end
      end
    end
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end
end

Any help would be really appreciated!


Solution

  • You can edit your eas.json profile to include the CocoaPods and Xcode image that you want to use to build your project.

    "profileExample": {
      "ios": {
        "cocoapods": "1.12.1",
        "image": "macos-monterey-12.6-xcode-14.2"
      }
    }