Xcode 错误 PhaseScriptExecution 失败,退出代码非零

Tai*_*der 21 xcode ios flutter flutter-build flutter-ios-build

我已经创建了 flutter 应用程序,现在想要创建存档以便在 Xcode 14.3 中分发。

问题

  1. 存档已禁用。
  2. 构建失败时出现此错误PhaseScriptExecution failed with a nonzero exit code

已经尝试过了

  1. 吊舱安装
  2. 清理构建文件夹
  3. 在终端应用程序中打开 Xcode 项目文件夹。输入并执行以下命令: pod deintegrate 执行此命令: pod install 重新打开 Xcode > 转到“产品”>“清理构建文件夹”。再次运行您的应用程序。

注意 转到“钥匙串访问”。从禁用的登录选项中再次选择“锁定和解锁”。如何启用它?

期待您的帮助。

截屏 在此输入图像描述

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
Run Code Online (Sandbox Code Playgroud)

Maz*_*far 57

你应该在你的项目中搜索这个文件:

Pods-[您的项目名称]-frameworks.sh (...-frameworks.sh)

并编辑此部分:

 if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi
Run Code Online (Sandbox Code Playgroud)

 if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")"
  fi
Run Code Online (Sandbox Code Playgroud)

源=“$(readlink“$ {source}”)”----->源=“$(readlink -f“$ {source}”)”

解决方法是更新所有生成的 ...-frameworks.sh 文件,以将 -f 标志添加到对 readlink 的调用中。换句话说,将 source="$(readlink "${source}")" 替换为 source="$(readlink -f "${source}")"

在此输入图像描述

此链接可能对您有帮助: https ://github.com/CocoaPods/CocoaPods/issues/11808


Tai*_*der 29

正如建议的

@Maziar萨达法尔

按照下面步骤 1 中的说明进行操作,在此之后,我还必须按照步骤 2 中的说明做另一件事。

  1. 您应该在项目中搜索此文件:

Pods-[您的项目名称]-frameworks.sh (...-frameworks.sh)

并编辑此部分:

if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi
Run Code Online (Sandbox Code Playgroud)

if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")"
  fi
Run Code Online (Sandbox Code Playgroud)

源=“$(readlink“$ {source}”)”----->源=“$(readlink -f“$ {source}”)”

解决方法是更新所有生成的 ...-frameworks.sh 文件,以将 -f 标志添加到对 readlink 的调用中。换句话说,将 source="$(readlink "${source}")" 替换为 source="$(readlink -f "${source}")"

  1. 打开 Xcode - 单击 Runner(顶部) 从“PROJECT”而不是“TARGETS”中选择 Runner 选择配置并更新所有模式,如下图所示 在此输入图像描述

  • 我刚刚转向 M1 芯片,但这对我不起作用。使用 Xcode 14.3 & Flutter 3.7.11 & Cocoapods 1.12.0 (2认同)

小智 6

这对我有用:更新node_modules/react-native/scripts/find-node.sh @ L7

  • 设置-e
  • 设置+e