ios Xcode 中的运行脚本和构建阶段在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39632301/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:19:40  来源:igfitidea点击:

Where is the Run Script and Build Phase in Xcode?

iosxcodeapplescriptcarthage

提问by Suragch

To get Carthage set up, the documentationsays that you need to add a Run Script.

要设置 Carthage,文档说您需要添加一个运行脚本。

On your application targets' “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”.Create a Run Script in which you specify your shell (ex: bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks

and add the paths to the frameworks you want to use under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/Box.framework
$(SRCROOT)/Carthage/Build/iOS/Result.framework
$(SRCROOT)/Carthage/Build/iOS/ReactiveCocoa.framework

This script works around an App Store submission bug triggered by universal binaries and ensures that necessary bitcode-related files and dSYMs are copied when archiving.

在您的应用程序目标的“构建阶段”设置选项卡上,单击“+”图标并选择“新建运行脚本阶段”。创建一个运行脚本,在其中指定您的外壳(例如:bin/sh),将以下内容添加到外壳下方的脚本区域:

/usr/local/bin/carthage copy-frameworks

并在“输入文件”下添加您要使用的框架的路径,例如:

$(SRCROOT)/Carthage/Build/iOS/Box.framework
$(SRCROOT)/Carthage/Build/iOS/Result.framework
$(SRCROOT)/Carthage/Build/iOS/ReactiveCocoa.framework

该脚本解决了由通用二进制文件触发的 App Store 提交错误,并确保在归档时复制必要的与位码相关的文件和 dSYM。

However, I can't find the Build Phases tab anymore or Run Script in the Build Settings search. The Xcode 8 Release Notesmention

但是,我再也找不到 Build Phases 选项卡或 Build Settings 搜索中的 Run Script。在Xcode中8发行说明

Xcode 8 provides completely rewritten AppleScript support. A new scripting dictionary provides the ability to automate Xcode workflows.

Xcode 8 提供完全重写的 AppleScript 支持。新的脚本字典提供了自动化 Xcode 工作流程的能力。

Does that mean there is no more Run Script? I looked at AppleScriptbut honestly it looks overwhelmingly complex. Do I need to learn AppleScript just to add the simple one liner that I used to do in Xcode?

这是否意味着不再有运行脚本?我查看了AppleScript,但老实说它看起来非常复杂。我是否需要学习 AppleScript 来添加我过去在 Xcode 中做的简单的一个衬垫?

/usr/local/bin/carthage copy-frameworks

回答by Suragch

It is still there. Make sure you click everywhere indicated in red in the image below.

它仍然存在。确保单击下图中红色标记的所有位置。

enter image description here

在此处输入图片说明

回答by Artem Novichkov

Carthage maintainers updated README, it is necessary to add output paths too to prevent useful copying of frameworks. I have released simple script named Cartingto automate these steps.

Carthage 维护者更新了 README,也有必要添加输出路径以防止有用的框架复制。我发布了一个名为Carting 的简单脚本来自动化这些步骤。