Xcode 11 Beta 7 命令 PhaseScriptExecution 失败,退出代码非零([CP] 复制 Pods 资源)

Xcode 11 Beta 7 Command PhaseScriptExecution failed with a nonzero exit code ([CP] Copy Pods Resources)

最近下载了 Xcode 11 Beta 来测试我在 iOS 13 中的应用程序,我 运行 遇到了一个我似乎无法弄清楚的问题。每次在 [CP] 复制 Pods 资源步骤中构建都失败,说 "Command PhaseScriptExecution failed with a nonzero exit code"。现在我知道这是任何 运行 脚本阶段失败时的错误,但通常会随此错误一起提供 一些 有用的信息。

错误输出:

ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target 11.0 --output-format human-readable-text --compile /Users/chris/Library/Developer/Xcode/DerivedData/SmartPager-dcfjsnhrgkjfeabbvafghvwsrsxr/Build/Products/Debug-iphoneos/SmartPager Sandbox.app/JSQMessagesViewController.nib 
/Users/chris/Work/projectname/Pods/JSQMessagesViewController/JSQMessagesViewController/Controllers/JSQMessagesViewController.xib --sdk /Users/chris/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk --target-device ipad --target-device iphone
2019-09-06 13:26:17.003 IBAgent-iOS[39395:514843] Incorrect screen size for <UIScreen: 0x7fb0e05245a0; bounds = {{0, 0}, {0, 0}}> in UICollectionViewData
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target 11.0 --output-format human-readable-text --compile /Users/chris/Library/Developer/Xcode/DerivedData/SmartPager-dcfjsnhrgkjfeabbvafghvwsrsxr/Build/Products/Debug-iphoneos/SmartPager Sandbox.app/JSQMessagesCollectionViewCellIncoming.nib /Users/chris/Work/projectname/Pods/JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesCollectionViewCellIncoming.xib --sdk /Users/chris/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk --target-device ipad --target-device iphone
Command PhaseScriptExecution failed with a nonzero exit code

相关信息: 据我所知,这可能与我们正在使用的已弃用的 cocoapod 有关,特别是 JSQMessagesViewController (7.3.5)。显然使用已弃用的库不是很好,但它在 Xcode 10 中构建和 运行 就很好,所以我不知道问题可能是什么。在一个单独的项目中,我尝试只添加这个 pod,但它抛出了同样的错误。关于 "incorrect screen size..." 的行似乎只是一个警告而不是错误,因为在 Xcode 10 中它使用同一行正确编译。

我试过重新启动计算机、清理、删除派生数据,以及所有常见的东西。我只是不知道现在还能去哪里找。任何建议将不胜感激。谢谢!

已更新

终于,我找到了解决这个问题的方法。

  • 首先将 JSQMessagesViewController 分叉到您的 GitHub 回购
  • 将存储库克隆到您的本地文件夹
  • 用Xcode11
  • 打开JSQMessages.xcworkspace
  • 打开 JSQMessagesViewController -> Views 文件夹
  • 单击其中一个 xib 文件并设置 Interface Builder 文档iOS10.0 and Later
  • 构建
  • 以这种方式设置每个 xib 文件。
  • 将这些更改推送到您的仓库和pod install这个仓库

希望对您有所帮助:)

事实证明,编译其中一个未报告的相关 xib 文件时出错。将 pod 直接复制到我的项目中开始显示问题。

正如 Ethan Wen 评论的那样,在您的项目中(如果您使用 Cocoapods)搜索 JSQMessagesViewController 的所有 .xib 文件,并在第一个选项卡(文件检查器)的右侧面板中,查找部分 'Interface Builder Document' 并将其从 'iOS 8.0 and later' 更改为 'iOS 10.0 and later'。这对我有用 XCode 11 GM seed 2.

清理项目后放弃本地更改并尝试构建项目。这在 XCode 11.

为我解决了这个问题

我在将 Firebase crashlytics 添加到 Build Phases 时遇到了同样的问题 -> 运行 脚本.

最近我已经更新到新的 OS Catalina 10.15.4,自从我将 shell 从 bash[=26 更改后,它开始引起问题=] 到 zsh

正如您猜想的那样,将您的 运行 脚本 shell 路径更改为如下所示。或 /bin/zsh 它会起作用。

我在使用 Carthage 的几天里一直收到这个错误。我可以通过转到“构建阶段”>“嵌入框架”然后取消选中 'Code Sign on copy' 来修复它。 然后重新 bootstrap 与 迦太基 bootstrap --平台 iOS 然后在 xCode

重建