ios – xcodebuild工作区和方案

对于指定工作空间和方案时,xcodebuild命令行工具会发生什么,我有些困惑.

我了解配置的方案在XCode IDE GUI中的工作原理.构建操作列出要构建的目标和每个操作(分析,测试,运行,配置文件,存档)的目标,您选择要执行构建操作的目标.

因此,如果我在构建操作中选择了每个操作(分析,存档),那么当我执行以下命令时会发生什么.

xcodebuild clean install -workspace MyWorkspace.xcworkspace -scheme MyScheme 
-configuration AdHoc SYMROOT=PATH DSTROOT=PATH...

它在主xcodeproj中搜索MyScheme.xcscheme,它在XCode中编辑方案时指定了所有此配置.

从这个文件读取xcodebuild是什么?它是否使用AdHoc配置构建配置的目标,并忽略其他所有内容

解决方法

你几乎在那里,但你的语法有点偏离.
根据 man page

xcodebuild -workspace workspacename -scheme schemename [-configuration configurationname]
[-sdk [sdkfullpath | sdkname]] [buildaction …] [setting=value …]
[-userdefault=value …]

其中buildaction是以下之一:

buildaction …
Specify a build action (or actions) to perform on the target. Available build actions are:

build       Build the target in the build root (SYMROOT).  This is the default build action.

       archive     Archive a scheme from the build root (SYMROOT).  This requires specifying a scheme.

       test        Test a scheme from the build root (SYMROOT).  This requires specifying a scheme.

       installsrc  copy the source of the project to the source root (SRCROOT).

       install     Build the target and install it into the target's installation directory in the dis-
                   tribution root (DSTROOT).

       clean       Remove build products and intermediate files from the build root (SYMROOT).

在Xcode IDE中,您可以选择通过“产品”菜单进行的构建操作,或者单击并按住IDE左上角的圆形按钮(Run = Play triangle,Test =扳手图标等).

另外,请注意,xcodebuild正在寻找您的构建方案,它可以在.xcproj或.xcworkspace文件中,具体取决于您创建的文件.
(如果您没有手动创建工作区,则将具有.xcproj文件).

您还可以通过Xcode中的“管理方案”设置来确定哪些方案.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...