flutter Xcode 14:Command PhaseScriptExecution失败,退出代码为非零

wooyq4lh  于 2023-04-07  发布在  Flutter
关注(0)|答案(6)|浏览(307)

在将我的Xcode更新到14.0版本后,我得到了这个错误:
命令PhaseScriptExecution失败,退出代码为非零
如果有人知道如何解决,请告诉我。

lymnna71

lymnna711#

单击项目上的属性,转到构建阶段并选中“仅用于安装构建”选项

yxyvkwin

yxyvkwin2#

在项目中搜索以下行:

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

改为:

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

k2fxgqgv3#

也许问题出在“运行脚本”上
我确实把firebase的crashlytics从“pod”改成了“Packeges”。但是我没有改变脚本。我已经试过了所有的解决方案
“https://stackoverflow.com/questions/53289524/xcode-10-2-1-command-phasescriptexecution-failed-with-a-nonzero-exit-code“
我的解决方案是改变目标-〉构建阶段。在脚本字段的形式

"${PODS_ROOT}/FirebaseCrashlytics/run"

"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"

简而言之,问题是你的剧本,把它做好
如果脚本是只安装版本。你需要目标-〉构建阶段-〉运行脚本-〉检查“只安装版本”
例如:

APP_PATH=“${TARGET_BUILD_DIR}/${WRAPPER_NAME}”
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find “$APP_PATH” -name ‘*.framework’ -type d | while read -r FRAMEWORK
do
  FRAMEWORK_EXECUTABLE_NAME=$(defaults read “$FRAMEWORK/Info.plist” CFBundleExecutable)
  FRAMEWORK_EXECUTABLE_PATH=“$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME”
  echo “Executable is $FRAMEWORK_EXECUTABLE_PATH”
  EXTRACTED_ARCHS=()
  for ARCH in $ARCHS
  do
    echo “Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME”
    lipo -extract “$ARCH” “$FRAMEWORK_EXECUTABLE_PATH” -o “$FRAMEWORK_EXECUTABLE_PATH-$ARCH”
    EXTRACTED_ARCHS+=(“$FRAMEWORK_EXECUTABLE_PATH-$ARCH”)
  done
  echo “Merging extracted architectures: ${ARCHS}”
  lipo -o “$FRAMEWORK_EXECUTABLE_PATH-merged” -create “${EXTRACTED_ARCHS[@]}”
  rm “${EXTRACTED_ARCHS[@]}”
  echo “Replacing original executable with thinned version”
  rm “$FRAMEWORK_EXECUTABLE_PATH”
  mv “$FRAMEWORK_EXECUTABLE_PATH-merged” “$FRAMEWORK_EXECUTABLE_PATH”
done
xmq68pz9

xmq68pz94#

在我这边,这个问题出现在我更换电脑时,问题是由Apple Silicon处理器引起的。当我开始使用M1 Pro时,我没有检查安装页面,而是直接通过Fvm安装了Flutter。当我检查安装页面时,我看到有几个步骤可以在Apple Slicon上安装Flutter。这些步骤解决了这个问题;

sudo softwareupdate --install-rosetta --agree-to-license

参考:https://docs.flutter.dev/get-started/install/macos

jtjikinw

jtjikinw5#

我已经从我的项目中删除了一个依赖项,但忘记删除App.js中的导入。由于.这一问题的出现。仔细查看后。到错误消息通知,删除后。依赖项形式App.js项目运行成功。

qij5mzcb

qij5mzcb6#

那些在将Xcode 14.2更新到14.3(14 E222 b)后遇到此问题的人,请尝试以下步骤来运行和归档应用程序。

1.首先升级你的flutter版本到3.7.10,因为这个问题在3.7.10中得到了修复(点击这里)
1.从Xcode Runner -〉PROJECT(Runner)-〉Info -〉Deployment Target -〉iOS Deployment Target -〉Set to 12.0(Minimum)

1.从Xcode Runner -〉TARGETS(Runner)-〉General -〉Minimum Deployments -〉iOS -〉Set to 12.0(Minimum)

1.从Xcode Pods -〉PROJECT(Pods)-〉Info -〉Deployment Target -〉iOS Deployments Target -〉Set to 12.0(Minimum)

1.从Xcode -〉Pods(Expand)-〉Target Support Files -〉Pods-Runner -〉Pods-Runner-frameworks
变更

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

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

从你的flutter项目-〉ios -〉Podfile
变更

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
         end
    end
  end
end

相关问题