目录

前言 1.1

Xcode开发概览 1.2

Xcode开发心得 1.3

安装Xcode 1.3.1

升级Xcode 1.3.1.1

Command Line Tools 1.3.2

xcodebuild 1.3.2.1

xcrun 1.3.2.2

Signing 1.3.3

iOS设备 1.3.4

iPhone 1.3.4.1

iOS Simulator 1.3.4.2

日志 1.3.5

调试运行 1.3.5.1

崩溃 1.3.5.2

其他 1.3.6

子教程 1.4

附录 1.5

参考资料 1.5.1

前言

Xcode开发心得

最新版本：v0.7

更新时间：20230713

简介

总结Xcode相关的开发心得。先是概览；然后总结Xcode开发的心得，包括安装和升级Xcode；Command Line Tools命令行工具，包括xcodebuild和xcrun；以及Signing签名、iOS设备的iPhone和iOS模拟器；日志，包括调试和崩溃；以及其他心得；以及相关子教程。

源码+浏览+下载

本书的各种源码、在线浏览地址、多种格式文件下载如下：

HonKit源码

crifan/xcode_dev_summary: Xcode开发心得

如何使用此HonKit源码去生成发布为电子书

详见：crifan/honkit_template: demo how to use crifan honkit template and demo

在线浏览

Xcode开发心得 book.crifan.org

Xcode开发心得 crifan.github.io

离线下载阅读

Xcode开发心得 PDF

Xcode开发心得 ePub

Xcode开发心得 Mobi

版权和用途说明

此电子书教程的全部内容，如无特别说明，均为本人原创。其中部分内容参考自网络，均已备注了出处。如发现有侵权，请通过邮箱联系我 admin 艾特 crifan.com，我会尽快删除。谢谢合作。

各种技术类教程，仅作为学习和研究使用。请勿用于任何非法用途。如有非法用途，均与本人无关。

鸣谢

感谢我的老婆陈雪的包容理解和悉心照料，才使得我crifan有更多精力去专注技术专研和整理归纳出这些电子书和技术教程，特此鸣谢。

其他

作者的其他电子书

本人crifan还写了其他150+本电子书教程，感兴趣可移步至：

crifan/crifan_ebook_readme: Crifan的电子书的使用说明

关于作者

关于作者更多介绍，详见：

关于CrifanLi李茂 – 在路上

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2023-07-13 21:49:37

Xcode开发概览

Xcode开发概览

在弄苹果相关开发期间，往往要用到Apple苹果自带的这个IDE：Xcode

此处就整理相关的开发心得。

Xcode

是什么：Apple苹果生态中，用来开发的IDE

支持各种Apple的平台和系统

桌面端：macOS

移动端：

iPhone类：iOS

iPad类：ipadOS

Apple TV：tvOS

Apple Watch：watchOS

功能

IDE的标准功能：编写代码、调试等

额外：还内置附带了其他一些命令行工具

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 09:50:23

Xcode开发心得

Xcode开发心得

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 09:38:34

安装Xcode

安装Xcode

TODO：

【已解决】Mac提示：Error Xcode alone is not sufficient on Catalina

【已解决】下载直接可以安装的XCode安装文件而非AppStore中下载和安装

【已解决】Mac中安装最新版XCode

【已解决】Mac中通过AppStore下载和安装XCode

下载=安装来源

安装来源

AppStore中搜并安装XCode

此处安装的是最新的13.0

也可以单独从网站中下载特定版本再安装

Xcode Releases | xcodereleases.com

举例

12.5.1

地址

https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_12.5.1/Xcode_12.5.1.xip

->

https://download.developer.apple.com/Developer_Tools/Xcode_12.5.1/Xcode_12.5.1.xip

安装Xcode前要确认自己的macOS版本是否满足要求

要安装XCode 13.0，发现当前MacOS版本macOS Catalina 10.15.7不支持，无法安装。

导致了必须去升级macOS到最新版：macOS 11.6 Big Sur才能正常继续安装XCode的。

安装过程

此处macOS中安装指定版本的11.3.1的XCode：

浏览器打开

More Software Downloads - Apple Developer

然后用自己的AppleID账号登录

登录后可以看到，历史上各个版本的XCode

找到自己要的11.3.1的XCode

https://download.developer.apple.com/Developer_Tools/Xcode_11.3.1/Xcode_11.3.1.xip

下载。

下载后，双击 Xcode_11.3.1.xip 会自动解压出 Xcode

把XCode拖动到应用程序文件夹。

再双击启动，首次会弹框点击同意和输入系统账号和密码。

等待安装成功后，即可。

此处会默认安装：XCode的命令行工具 xcodebuild，所以无需额外下载安装。

注：

如果需要，可以单独下载XCode的命令行工具：

https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_11.3.1/Command_Line_Tools_for_Xcode_11.3.1.dmg

然后去安装。

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 11:14:00

升级Xcode

升级Xcode

TODO：

【已解决】Mac的macOS Catalina 10.15.7去升级XCode

【记录】升级后继续使用Xcode

［记录］Xcode更新升级

小心得：

每次Xcode的升级，都是伴随着相关的其他系统的版本一起升级的：

Swift

iOS

watchOS

tvOS

macOS

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 11:15:39

Command Line Tools

Command Line Tools

TODO：

【已解决】Mac中已登录苹果开发者账号点击下载Command Line Tool提示Unauthorized没权限

Xcode，除了有图形界面的UI外，还额外提供了一些，基于命令行的各种工具=Command Line Tools

Command Line Tools

是什么：Xcode的基于命令行的各种命令行工具。

安装位置：/Library/Developer/CommandLineTools/

包含哪些

命令行工具

xcodebuild

xcrun

各种子命令

clang = Apple LLVM compiler

linker

Make

等

macOS SDK和头文件header

Xcode界面中会提到

Xcode->Preferences->Locations->Locations->Command Line Tools: 此处是 Xcode 13.2.1 (13C100)

包含的全部命令

更多的命令，详见：

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

举例：

 ll /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
total 800272
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-ar
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-as
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-dsymutil
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-libtool
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-link
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-lipo
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-lld
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-nm
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-objdump
lrwxr-xr-x  1 crifan  staff     6B  6 28 20:26 air-ranlib -> air-ar
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-readobj
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 air-size
-rwxr-xr-x  1 crifan  staff   168K 12 15  2021 ar
-rwxr-xr-x  1 crifan  staff   150K 12 15  2021 as
-rwxr-xr-x  1 crifan  staff   163K 12 15  2021 asa
-rwxr-xr-x  1 crifan  staff   520K 12 15  2021 bison
-rwxr-xr-x  1 crifan  staff   434K 12 15  2021 bitcode_strip
lrwxr-xr-x  1 crifan  staff     5B  6 28 20:27 c++ -> clang
lrwxr-xr-x  1 crifan  staff    12B  6 28 20:27 c++filt -> llvm-cxxfilt
-rwxr-xr-x  1 crifan  staff   164K 12 15  2021 c89
-rwxr-xr-x  1 crifan  staff   164K 12 15  2021 c99
lrwxr-xr-x  1 crifan  staff     5B  6 28 20:27 cc -> clang
-rwxr-xr-x  1 crifan  staff   181M 12 15  2021 clang
lrwxr-xr-x  1 crifan  staff     5B  6 28 20:27 clang++ -> clang
-rwxr-xr-x  1 crifan  staff    80M 12 15  2021 clangd
-rwxr-xr-x  1 crifan  staff   350K 12 15  2021 cmpdylib
-rwxr-xr-x  1 crifan  staff   382K 12 15  2021 codesign_allocate
lrwxr-xr-x  1 crifan  staff    17B  6 28 20:27 codesign_allocate-p -> codesign_allocate
lrwxr-xr-x  1 crifan  staff    14B  6 28 20:27 coremlc -> coremlcompiler
-rwxr-xr-x  1 crifan  staff    20M 12 15  2021 coremlcompiler
-rwxr-xr-x  1 crifan  staff   3.3K 10 26  2021 cpp
-rwxr-xr-x  1 crifan  staff   164K 12 15  2021 ctags
-rwxr-xr-x  1 crifan  staff   433K 12 15  2021 ctf_insert
-rwxr-xr-x  1 crifan  staff    19M 12 15  2021 docc
-rwxr-xr-x  1 crifan  staff    61M 12 15  2021 dsymutil
lrwxr-xr-x  1 crifan  staff    14B  6 28 20:28 dwarfdump -> llvm-dwarfdump
-rwxr-xr-x  1 crifan  staff   1.5M 12 15  2021 dwarfdump-classic
-rwxr-xr-x  1 crifan  staff   497K 12 15  2021 dyldinfo
-rwxr-xr-x  2 crifan  staff   681K 12 15  2021 flex
-rwxr-xr-x  2 crifan  staff   681K 12 15  2021 flex++
lrwxr-xr-x  1 crifan  staff     8B  6 28 20:29 gcov -> llvm-cov
-rwxr-xr-x  2 crifan  staff   392K 12 15  2021 gm4
-rwxr-xr-x  1 crifan  staff   294K 12 15  2021 gperf
-rwxr-xr-x  1 crifan  staff   267K 12 15  2021 iig
-rwxr-xr-x  1 crifan  staff   229K 12 15  2021 indent
-rwxr-xr-x  1 crifan  staff   433K 12 15  2021 install_name_tool
-rwxr-xr-x  1 crifan  staff   5.6M 12 15  2021 ld
-rwxr-xr-x  1 crifan  staff   230B 10 26  2021 lex
-rwxr-xr-x  1 crifan  staff   434K 12 15  2021 libtool
-rwxr-xr-x  1 crifan  staff   253K 12 15  2021 lipo
-rwxr-xr-x  1 crifan  staff   8.2M 12 15  2021 llvm-cov
-rwxr-xr-x  1 crifan  staff   859K 12 15  2021 llvm-cxxfilt
-rwxr-xr-x  1 crifan  staff    17M 12 15  2021 llvm-dwarfdump
-rwxr-xr-x  1 crifan  staff    20M 12 15  2021 llvm-nm
-rwxr-xr-x  1 crifan  staff    23M 12 15  2021 llvm-objdump
-rwxr-xr-x  1 crifan  staff   184K 12 15  2021 llvm-otool
-rwxr-xr-x  1 crifan  staff   3.6M 12 15  2021 llvm-profdata
-rwxr-xr-x  1 crifan  staff   6.7M 12 15  2021 llvm-size
-rwxr-xr-x  1 crifan  staff   3.5K 10 26  2021 lorder
-rwxr-xr-x  2 crifan  staff   392K 12 15  2021 m4
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 metal
lrwxr-xr-x  1 crifan  staff     6B  6 28 20:32 metal-ar -> air-ar
lrwxr-xr-x  1 crifan  staff     6B  6 28 20:32 metal-as -> air-as
lrwxr-xr-x  1 crifan  staff    12B  6 28 20:32 metal-dsymutil -> air-dsymutil
lrwxr-xr-x  1 crifan  staff    11B  6 28 20:32 metal-libtool -> air-libtool
lrwxr-xr-x  1 crifan  staff     8B  6 28 20:32 metal-link -> air-link
lrwxr-xr-x  1 crifan  staff     8B  6 28 20:32 metal-lipo -> air-lipo
lrwxr-xr-x  1 crifan  staff     7B  6 28 20:32 metal-lld -> air-lld
lrwxr-xr-x  1 crifan  staff     6B  6 28 20:32 metal-nm -> air-nm
lrwxr-xr-x  1 crifan  staff    11B  6 28 20:32 metal-objdump -> air-objdump
lrwxr-xr-x  1 crifan  staff    10B  6 28 20:32 metal-ranlib -> air-ranlib
lrwxr-xr-x  1 crifan  staff    11B  6 28 20:32 metal-readobj -> air-readobj
lrwxr-xr-x  1 crifan  staff     8B  6 28 20:32 metal-size -> air-size
-rwxr-xr-x  1 crifan  staff   265K 12 15  2021 metal-source
lrwxr-xr-x  1 crifan  staff     7B  6 28 20:32 metallib -> air-lld
-rwxr-xr-x  1 crifan  staff   7.7K 10 26  2021 mig
lrwxr-xr-x  1 crifan  staff     7B  6 28 20:32 nm -> llvm-nm
-rwxr-xr-x  1 crifan  staff   383K 12 15  2021 nm-classic
-rwxr-xr-x  1 crifan  staff   467K 12 15  2021 nmedit
lrwxr-xr-x  1 crifan  staff    12B  6 28 20:32 objdump -> llvm-objdump
lrwxr-xr-x  1 crifan  staff    10B  6 28 20:32 otool -> llvm-otool
-rwxr-xr-x  1 crifan  staff   1.4M 12 15  2021 otool-classic
-rwxr-xr-x  1 crifan  staff   382K 12 15  2021 pagestuff
lrwxr-xr-x  1 crifan  staff     7B  6 28 20:33 ranlib -> libtool
-rwxr-xr-x  1 crifan  staff   261K 12 15  2021 rpcgen
-rwxr-xr-x  1 crifan  staff   186K 12 15  2021 segedit
lrwxr-xr-x  1 crifan  staff    12B  6 28 20:33 size -> size-classic
-rwxr-xr-x  1 crifan  staff   349K 12 15  2021 size-classic
-rwxr-xr-x  1 crifan  staff    30M 12 15  2021 sourcekit-lsp
-rwxr-xr-x  1 crifan  staff   350K 12 15  2021 strings
-rwxr-xr-x  1 crifan  staff   520K 12 15  2021 strip
lrwxr-xr-x  1 crifan  staff    14B  6 28 20:33 swift -> swift-frontend
lrwxr-xr-x  1 crifan  staff    14B  6 28 20:33 swift-api-digester -> swift-frontend
lrwxr-xr-x  1 crifan  staff    14B  6 28 20:33 swift-api-extract -> swift-frontend
-rwxr-xr-x  1 crifan  staff    59M 12 15  2021 swift-build
-rwxr-xr-x  1 crifan  staff   1.4M 12 15  2021 swift-build-tool
-rwxr-xr-x  1 crifan  staff   1.3M 12 15  2021 swift-demangle
-rwxr-xr-x  1 crifan  staff    26M 12 15  2021 swift-driver
-rwxr-xr-x  1 crifan  staff   214M 12 15  2021 swift-frontend
-rwxr-xr-x  1 crifan  staff    11M 12 15  2021 swift-help
-rwxr-xr-x  1 crifan  staff    59M 12 15  2021 swift-package
-rwxr-xr-x  1 crifan  staff    59M 12 15  2021 swift-package-collection
-rwxr-xr-x  1 crifan  staff    59M 12 15  2021 swift-run
-rwxr-xr-x  1 crifan  staff   185K 12 15  2021 swift-stdlib-tool
lrwxr-xr-x  1 crifan  staff    14B  6 28 20:34 swift-symbolgraph-extract -> swift-frontend
-rwxr-xr-x  1 crifan  staff    59M 12 15  2021 swift-test
lrwxr-xr-x  1 crifan  staff    14B  6 28 20:34 swiftc -> swift-frontend
-rwxr-xr-x  1 crifan  staff    33M 12 15  2021 tapi
-rwxr-xr-x  1 crifan  staff   3.1M 12 15  2021 tapi-analyze
-rwxr-xr-x  1 crifan  staff   165K 12 15  2021 unifdef
-rwxr-xr-x  1 crifan  staff   2.9K 10 26  2021 unifdefall
-rwxr-xr-x  1 crifan  staff   203K 12 15  2021 unwinddump
-rwxr-xr-x  1 crifan  staff   220K 12 15  2021 vtool
-rwxr-xr-x  1 crifan  staff   135B 10 26  2021 yacc

子命令举例

clang

 clang -v
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

gcc

 gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 11:14:11

xcodebuild

xcodebuild

xcodebuild

是什么：Xcode的命令行工具

作用：用于命令行方式去编译项目

好处：而无需打开Xcode图形界面去操作

可用于自动化部署等方面

用法举例：

UDID=ed94089f3e34d5538065a695bfdf03dfbb3c5579
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=$UDID" test

语法和说明

help语法

 crifan@licrifandeMacBook-Pro  ~  xcodebuild --help
Usage: xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings [-json]] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild [-project <projectname>] -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings [-json]] [-showdestinations] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild -workspace <workspacename> -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [-showdestinations] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [-json] [<infoitem>] ]
       xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]] [-json]
       xcodebuild -showsdks [-json]
       xcodebuild -exportArchive -archivePath <xcarchivepath> [-exportPath <destinationpath>] -exportOptionsPlist <plistpath>
       xcodebuild -exportNotarizedApp -archivePath <xcarchivepath> -exportPath <destinationpath>
       xcodebuild -exportLocalizations -localizationPath <path> -project <projectname> [-exportLanguage <targetlanguage>...[-includeScreenshots]]
       xcodebuild -importLocalizations -localizationPath <path> -project <projectname> [-mergeImport]
       xcodebuild -resolvePackageDependencies [-project <projectname>|-workspace <workspacename>] -clonedSourcePackagesDirPath <path>
       xcodebuild -create-xcframework [-help] [-framework <path>] [-library <path> [-headers <path>]] -output <path>

Options:
    -usage                                                   print brief usage
    -help                                                    print complete usage
    -verbose                                                 provide additional status output
    -license                                                 show the Xcode and SDK license agreements
    -checkFirstLaunchStatus                                  Check if any First Launch tasks need to be performed
    -runFirstLaunch                                          install packages and agree to the license
    -project NAME                                            build the project NAME
    -target NAME                                             build the target NAME
    -alltargets                                              build all targets
    -workspace NAME                                          build the workspace NAME
    -scheme NAME                                             build the scheme NAME
    -configuration NAME                                      use the build configuration NAME for building each target
    -xcconfig PATH                                           apply the build settings defined in the file at PATH as overrides
    -arch ARCH                                               build each target for the architecture ARCH; this will override architectures defined in the project
    -sdk SDK                                                 use SDK as the name or path of the base SDK when building the project
    -toolchain NAME                                          use the toolchain with identifier or name NAME
    -destination DESTINATIONSPECIFIER                        use the destination described by DESTINATIONSPECIFIER (a comma-separated set of key=value pairs describing the destination to use)
    -destination-timeout TIMEOUT                             wait for TIMEOUT seconds while searching for the destination device
    -parallelizeTargets                                      build independent targets in parallel
    -jobs NUMBER                                             specify the maximum number of concurrent build operations
    -maximum-concurrent-test-device-destinations NUMBER      the maximum number of device destinations to test on concurrently
    -maximum-concurrent-test-simulator-destinations NUMBER   the maximum number of simulator destinations to test on concurrently
    -parallel-testing-enabled YES|NO                         overrides the per-target setting in the scheme
    -parallel-testing-worker-count NUMBER                    the exact number of test runners that will be spawned during parallel testing
    -maximum-parallel-testing-workers NUMBER                 the maximum number of test runners that will be spawned during parallel testing
    -dry-run                                                 do everything except actually running the commands
    -quiet                                                   do not print any output except for warnings and errors
    -hideShellScriptEnvironment                              don't show shell script environment variables in build log
    -showsdks                                                display a compact list of the installed SDKs
    -showdestinations                                        display a list of destinations
    -showTestPlans                                           display a list of test plans
    -showBuildSettings                                       display a list of build settings and values
    -showBuildSettingsForIndex                               display build settings for the index service
    -list                                                    lists the targets and configurations in a project, or the schemes in a workspace
    -find-executable NAME                                    display the full path to executable NAME in the provided SDK and toolchain
    -find-library NAME                                       display the full path to library NAME in the provided SDK and toolchain
    -version                                                 display the version of Xcode; with -sdk will display info about one or all installed SDKs
    -enableAddressSanitizer YES|NO                           turn the address sanitizer on or off
    -enableThreadSanitizer YES|NO                            turn the thread sanitizer on or off
    -enableUndefinedBehaviorSanitizer YES|NO                 turn the undefined behavior sanitizer on or off
    -resultBundlePath PATH                                   specifies the directory where a result bundle describing what occurred will be placed
    -resultStreamPath PATH                                   specifies the file where a result stream will be written to (the file must already exist)
    -resultBundleVersion 3 [default]                         specifies which result bundle version should be used
    -clonedSourcePackagesDirPath PATH                        specifies the directory to which remote source packages are fetch or expected to be found
    -derivedDataPath PATH                                    specifies the directory where build products and other derived data will go
    -archivePath PATH                                        specifies the directory where any created archives will be placed, or the archive that should be exported
    -exportArchive                                           specifies that an archive should be exported
    -exportNotarizedApp                                      export an archive that has been notarized by Apple
    -exportOptionsPlist PATH                                 specifies a path to a plist file that configures archive exporting
    -enableCodeCoverage YES|NO                               turn code coverage on or off when testing
    -exportPath PATH                                         specifies the destination for the product exported from an archive
    -skipUnavailableActions                                  specifies that scheme actions that cannot be performed should be skipped instead of causing a failure
    -exportLocalizations                                     exports completed and outstanding project localizations
    -importLocalizations                                     imports localizations for a project, assuming any necessary localized resources have been created in Xcode
    -localizationPath                                        specifies a path to XLIFF localization files
    -exportLanguage                                          specifies multiple optional ISO 639-1 languages included in a localization export
    -xctestrun                                               specifies a path to a test run specification
    -enablePerformanceTestsDiagnostics YES|NO                enables performance trace and memgraph collection for performance XCTests
    -testPlan                                                specifies the name of the test plan associated with the scheme to use for testing
    -only-testing                                            constrains testing by specifying tests to include, and excluding other tests
    -only-testing:TEST-IDENTIFIER                            constrains testing by specifying tests to include, and excluding other tests
    -skip-testing                                            constrains testing by specifying tests to exclude, but including other tests
    -skip-testing:TEST-IDENTIFIER                            constrains testing by specifying tests to exclude, but including other tests
    -test-timeouts-enabled YES|NO                            enable or disable test timeout behavior
    -default-test-execution-time-allowance SECONDS           the default execution time an individual test is given to execute, if test timeouts are enabled
    -maximum-test-execution-time-allowance SECONDS           the maximum execution time an individual test is given to execute, regardless of the test's preferred allowance
    -test-iterations <number>                                If specified, tests will run <number> times. May be used in conjunction with either -retry-tests-on-failure or -run-tests-until-failure, in which case this will become the maximum number of iterations.
    -retry-tests-on-failure                                  If specified, tests will retry on failure. May be used in conjunction with -test-iterations <number>, in which case <number> will be the maximum number of iterations. Otherwise, a maximum of 3 is assumed. May not be used with -run-tests-until-failure.
    -run-tests-until-failure                                 If specified, tests will run until they fail. May be used in conjunction with -test-iterations <number>, in which case <number> will be the maximum number of iterations. Otherwise, a maximum of 100 is assumed. May not be used with -retry-tests-on-failure.
    -test-repetition-relaunch-enabled YES|NO                 Enable or disable, tests repeating in a new process for each repetition.  Must be used in conjunction with -test-iterations, -retry-tests-on-failure, or -run-tests-until-failure. If not specified, tests will repeat in the same process.
    -only-test-configuration                                 constrains testing by specifying test configurations to include, and excluding other test configurations
    -skip-test-configuration                                 constrains testing by specifying test configurations to exclude, but including other test configurations
    -testLanguage                                            constrains testing by specifying ISO 639-1 language in which to run the tests
    -testRegion                                              constrains testing by specifying ISO 3166-1 region in which to run the tests
    -resolvePackageDependencies                              resolves any Swift package dependencies referenced by the project or workspace
    -disableAutomaticPackageResolution                       prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file
    -onlyUsePackageVersionsFromResolvedFile                  prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file
    -disablePackageRepositoryCache                           disable use of a local cache of remote package repositories
    -packageCachePath                                        path of caches used for package support
    -json                                                    output as JSON (note: -json implies -quiet)
    -allowProvisioningUpdates                                Allow xcodebuild to communicate with the Apple Developer website. For automatically signed targets, xcodebuild will create and update profiles, app IDs, and certificates. For manually signed targets, xcodebuild will download missing or updated provisioning profiles. Requires a developer account to have been added in Xcode's Accounts preference pane or an App Store Connect authentication key to be specified via the -authenticationKeyPath, -authenticationKeyID, and -authenticationKeyIssuerID parameters.
    -allowProvisioningDeviceRegistration                     Allow xcodebuild to register your destination device on the developer portal if necessary. This flag only takes effect if -allowProvisioningUpdates is also passed.
    -authenticationKeyPath                                   specifies the path to an authentication key issued by App Store Connect. If specified, xcodebuild will authenticate with the Apple Developer website using this credential. The -authenticationKeyID and -authenticationKeyIssuerID parameters are required.
    -authenticationKeyID                                     specifies the key identifier associated with the App Store Conect authentication key at -authenticationKeyPath. This string can be located in the users and access details for your provider at "https://appstoreconnect.apple.com".
    -authenticationKeyIssuerID                               specifies the App Store Connect issuer identifier associated with the authentication key at -authenticationKeyPath. This string can be located in the users and access details for your provider at "https://appstoreconnect.apple.com".
    -scmProvider                                             which implementation to use for Git operations (system/xcode)
    -showBuildTimingSummary                                  display a report of the timings of all the commands invoked during the build
    -create-xcframework                                      create an xcframework from prebuilt libraries; -help for more information.

Available keys for -exportOptionsPlist:

    compileBitcode : Bool

        For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES.

    destination : String

        Determines whether the app is exported locally or uploaded to Apple. Options are export or upload. The available options vary based on the selected distribution method. Defaults to export.

    distributionBundleIdentifier : String

        Reformat archive to focus on eligible target bundle identifier.

    embedOnDemandResourcesAssetPacksInBundle : Bool

        For non-App Store exports, if the app uses On Demand Resources and this is YES, asset packs are embedded in the app bundle so that the app can be tested without a server to host asset packs. Defaults to YES unless onDemandResourcesAssetPacksBaseURL is specified.

    generateAppStoreInformation : Bool

        For App Store exports, should Xcode generate App Store Information for uploading with iTMSTransporter? Defaults to NO.

    iCloudContainerEnvironment : String

        If the app is using CloudKit, this configures the "com.apple.developer.icloud-container-environment" entitlement. Available options vary depending on the type of provisioning profile used, but may include: Development and Production.

    installerSigningCertificate : String

        For manual signing only. Provide a certificate name, SHA-1 hash, or automatic selector to use for signing. Automatic selectors allow Xcode to pick the newest installed certificate of a particular type. The available automatic selectors are "Developer ID Installer" and "Mac Installer Distribution". Defaults to an automatic certificate selector matching the current distribution method.

    manageAppVersionAndBuildNumber

        Should Xcode manage the app's build number when uploading to App Store Connect? Defaults to YES.

    manifest : Dictionary

        For non-App Store exports, users can download your app over the web by opening your distribution manifest file in a web browser. To generate a distribution manifest, the value of this key should be a dictionary with three sub-keys: appURL, displayImageURL, fullSizeImageURL. The additional sub-key assetPackManifestURL is required when using on-demand resources.

    method : String

        Describes how Xcode should export the archive. Available options: app-store, validation, ad-hoc, package, enterprise, development, developer-id, and mac-application. The list of options varies based on the type of archive. Defaults to development.

    onDemandResourcesAssetPacksBaseURL : String

        For non-App Store exports, if the app uses On Demand Resources and embedOnDemandResourcesAssetPacksInBundle isn't YES, this should be a base URL specifying where asset packs are going to be hosted. This configures the app to download asset packs from the specified URL.

    provisioningProfiles : Dictionary

        For manual signing only. Specify the provisioning profile to use for each executable in your app. Keys in this dictionary are the bundle identifiers of executables; values are the provisioning profile name or UUID to use.

    signingCertificate : String

        For manual signing only. Provide a certificate name, SHA-1 hash, or automatic selector to use for signing. Automatic selectors allow Xcode to pick the newest installed certificate of a particular type. The available automatic selectors are "Mac App Distribution", "iOS Distribution", "iOS Developer", "Developer ID Application", "Apple Distribution", "Mac Developer", and "Apple Development". Defaults to an automatic certificate selector matching the current distribution method.

    signingStyle : String

        The signing style to use when re-signing the app for distribution. Options are manual or automatic. Apps that were automatically signed when archived can be signed manually or automatically during distribution, and default to automatic. Apps that were manually signed when archived must be manually signed during distribtion, so the value of signingStyle is ignored.

    stripSwiftSymbols : Bool

        Should symbols be stripped from Swift libraries in your IPA? Defaults to YES.

    teamID : String

        The Developer Portal team to use for this export. Defaults to the team used to build the archive.

    thinning : String

        For non-App Store exports, should Xcode thin the package for one or more device variants? Available options: <none> (Xcode produces a non-thinned universal app), <thin-for-all-variants> (Xcode produces a universal app and all available thinned variants), or a model identifier for a specific device (e.g. "iPhone7,1"). Defaults to <none>.

    uploadBitcode : Bool

        For App Store exports, should the package include bitcode? Defaults to YES.

    uploadSymbols : Bool

        For App Store exports, should the package include symbols? Defaults to YES.

man xcodebuild

XCODEBUILD(1)             BSD General Commands Manual            XCODEBUILD(1)

NAME
     xcodebuild -- build Xcode projects and workspaces

SYNOPSIS
     xcodebuild [-project name.xcodeproj] [[-target targetname] ... | -alltargets] [-configuration configurationname]
                [-sdk [sdkfullpath | sdkname]] [action ...] [buildsetting=value ...] [-userdefault=value ...]

     xcodebuild [-project name.xcodeproj] -scheme schemename [[-destination destinationspecifier] ...] [-destination-timeout value]
                [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [action ...] [buildsetting=value ...] [-userdefault=value ...]

     xcodebuild -workspace name.xcworkspace -scheme schemename [[-destination destinationspecifier] ...] [-destination-timeout value]
                [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [action ...] [buildsetting=value ...] [-userdefault=value ...]

     xcodebuild -version [-sdk [sdkfullpath | sdkname]] [infoitem]

     xcodebuild -showsdks

     xcodebuild -showBuildSettings [-project name.xcodeproj | [-workspace name.xcworkspace -scheme schemename]]

     xcodebuild -showdestinations [-project name.xcodeproj | [-workspace name.xcworkspace -scheme schemename]]

     xcodebuild -showTestPlans [-project name.xcodeproj | -workspace name.xcworkspace] -scheme schemename

     xcodebuild -list [-project name.xcodeproj | -workspace name.xcworkspace]

     xcodebuild -exportArchive -archivePath xcarchivepath -exportPath destinationpath -exportOptionsPlist path
     xcodebuild -exportNotarizedApp -archivePath xcarchivepath -exportPath destinationpath

     xcodebuild -exportLocalizations -project name.xcodeproj -localizationPath path [[-exportLanguage language] ...]
     xcodebuild -importLocalizations -project name.xcodeproj -localizationPath path

DESCRIPTION
     xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an Xcode workspace or Xcode project.

   Usage
     To build an Xcode project, run xcodebuild from the directory containing your project (i.e. the directory containing the name.xcodeproj
     package). If you have multiple projects in the this directory you will need to use -project to indicate which project should be built.  By
     default, xcodebuild builds the first target listed in the project, with the default build configuration. The order of the targets is a
     property of the project and is the same for all users of the project.

     To build an Xcode workspace, you must pass both the -workspace and -scheme options to define the build.  The parameters of the scheme will
     control which targets are built and how they are built, although you may pass other options to xcodebuild to override some parameters of
     the scheme.

     There are also several options that display info about the installed version of Xcode or about projects or workspaces in the local direc-
     tory, but which do not initiate an action.  These include -list, -showBuildSettings, -showdestinations, -showsdks, -showTestPlans, -usage,
     and -version.

   Options
     -project name.xcodeproj
           Build the project name.xcodeproj.  Required if there are multiple project files in the same directory.

     -target targetname
           Build the target specified by targetname.

     -alltargets
           Build all the targets in the specified project.

     -workspace name.xcworkspace
           Build the workspace name.xcworkspace.

     -scheme schemename
           Build the scheme specified by schemename.  Required if building a workspace.

     -destination destinationspecifier
           Use the destination device described by destinationspecifier.  Defaults to a destination that is compatible with the selected scheme.
           See the Destinations section below for more details.

     -destination-timeout timeout
           Use the specified timeout when searching for a destination device. The default is 30 seconds.

     -configuration configurationname
           Use the build configuration specified by configurationname when building each target.

     -arch architecture
           Use the architecture specified by architecture when building each target.

     -sdk [sdkfullpath | sdkname]
           Build an Xcode project or workspace against the specified SDK, using build tools appropriate for that SDK. The argument may be an
           absolute path to an SDK, or the canonical name of an SDK.

     -showsdks
           Lists all available SDKs that Xcode knows about, including their canonical names suitable for use with -sdk.  Does not initiate a
           build.

     -showBuildSettings
           Lists the build settings in a project or workspace and scheme. Does not initiate a build. Use with -project or -workspace and
           -scheme.

     -showdestinations
           Lists the valid destinations for a project or workspace and scheme. Does not initiate a build. Use with -project or -workspace and
           -scheme.

     -showBuildTimingSummary
           Display a report of the timings of all the commands invoked during the build.

     -showTestPlans
           Lists the test plans (if any) associated with the specified scheme. Does not initiate a build. Use with -scheme.

     -list
           Lists the targets and configurations in a project, or the schemes in a workspace. Does not initiate a build. Use with -project or
           -workspace.

     -enableAddressSanitizer [YES | NO]
           Turns the address sanitizer on or off. This overrides the setting for the launch action of a scheme in a workspace.

     -enableThreadSanitizer [YES | NO]
           Turns the thread sanitizer on or off. This overrides the setting for the launch action of a scheme in a workspace.

     -enableUndefinedBehaviorSanitizer [YES | NO]
           Turns the undefined behavior sanitizer on or off. This overrides the setting for the launch action of a scheme in a workspace.

     -enableCodeCoverage [YES | NO]
           Turns code coverage on or off during testing. This overrides the setting for the test action of a scheme in a workspace.

     -testLanguage language
           Specifies ISO 639-1 language during testing. This overrides the setting for the test action of a scheme in a workspace.

     -testRegion region
           Specifies ISO 3166-1 region during testing. This overrides the setting for the test action of a scheme in a workspace.

     -derivedDataPath path
           Overrides the folder that should be used for derived data when performing an action on a scheme in a workspace.

     -resultBundlePath path
           Writes a bundle to the specified path with results from performing an action on a scheme in a workspace. If the path already exists,
           xcodebuild will exit with an error. Intermediate directories will be created automatically. The bundle contains build logs, code cov-
           erage reports, XML property lists with test results, screenshots and other attachments collected during testing, and various diagnos-
           tic logs.

     -allowProvisioningUpdates
           Allow xcodebuild to communicate with the Apple Developer website. For automatically signed targets, xcodebuild will create and update
           profiles, app IDs, and certificates. For manually signed targets, xcodebuild will download missing or updated provisioning profiles.
           Requires a developer account to have been added in Xcode's Accounts preference pane.
...
...
...

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 10:04:14

xcrun

xcrun

xcrun = Xcode Command-line RUNner

是什么：也是一个命令行工具

是调用其他Xcode命令行工具的入口

底层逻辑：所有Xcode的Command Line都会先被导向xcrun_main，也就是xcrun

用法举例

xcrun simctl list devices

 xcrun simctl list devices
== Devices ==
-- iOS 13.3 --
    iPhone 8 (54589698-0C9F-407D-B21A-83432CABB681) (Shutdown)
    iPhone 8 Plus (509B7103-97DB-4AB9-B829-001190ED4B7E) (Shutdown)
    iPhone 11 (509BC7C7-9C0E-42FA-8AB2-F5220EBAA13B) (Shutdown)
    iPhone 11 Pro (3E8E7E92-66F2-4AF3-A405-23B5FB231DE7) (Shutdown)
    iPhone 11 Pro Max (50C15135-1532-44C5-B82C-B327F88F2712) (Shutdown)
    iPad Pro (9.7-inch) (B11D5D40-FEA2-4114-B053-E4CFD29D127C) (Shutdown)
    iPad (7th generation) (7F8EDE89-74E0-4BAB-B3CA-09E2DAE1F095) (Shutdown)
    iPad Pro (11-inch) (04DD3B8A-5B78-48E8-8B22-56796A9CFB73) (Shutdown)
    iPad Pro (12.9-inch) (3rd generation) (D811684E-2F3E-4FC6-92EA-39301451F7E5) (Shutdown)
    iPad Air (3rd generation) (BBC48526-3922-4C97-BA14-B1888385243A) (Shutdown)
-- tvOS 13.3 --
    Apple TV (6680F059-4DE1-430C-B696-228AC27CAA88) (Shutdown)
    Apple TV 4K (048E58E8-6A27-4D81-BDEB-8812C610B756) (Shutdown)
    Apple TV 4K (at 1080p) (384D5E60-B6B1-481E-BDC3-B7FF8F773412) (Shutdown)
-- watchOS 6.1 --
    Apple Watch Series 4 - 40mm (1B98415B-3FDE-401B-A80C-A3551DB207D7) (Shutdown)
    Apple Watch Series 4 - 44mm (661838E9-B0BE-42B4-B55E-9A34263B1AEA) (Shutdown)
    Apple Watch Series 5 - 40mm (F76D77EF-0932-4164-94BB-9FC757420911) (Shutdown)
    Apple Watch Series 5 - 44mm (D86F0BD5-4D38-4537-9C8C-2F5C74E404CA) (Shutdown)

xcrun simctl list

 xcrun simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
iPhone SE (com.apple.CoreSimulator.SimDeviceType.iPhone-SE)
iPhone 7 (com.apple.CoreSimulator.SimDeviceType.iPhone-7)
iPhone 7 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-7-Plus)
iPhone 8 (com.apple.CoreSimulator.SimDeviceType.iPhone-8)
iPhone 8 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus)
iPhone X (com.apple.CoreSimulator.SimDeviceType.iPhone-X)
iPhone Xs (com.apple.CoreSimulator.SimDeviceType.iPhone-XS)
iPhone Xs Max (com.apple.CoreSimulator.SimDeviceType.iPhone-XS-Max)
iPhone Xʀ (com.apple.CoreSimulator.SimDeviceType.iPhone-XR)
iPhone 11 (com.apple.CoreSimulator.SimDeviceType.iPhone-11)
iPhone 11 Pro (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro)
iPhone 11 Pro Max (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
iPad mini 2 (com.apple.CoreSimulator.SimDeviceType.iPad-mini-2)
iPad mini 3 (com.apple.CoreSimulator.SimDeviceType.iPad-mini-3)
iPad mini 4 (com.apple.CoreSimulator.SimDeviceType.iPad-mini-4)
iPad Air 2 (com.apple.CoreSimulator.SimDeviceType.iPad-Air-2)
iPad Pro (9.7-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--9-7-inch-)
iPad Pro (12.9-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)
iPad (5th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--5th-generation-)
iPad Pro (12.9-inch) (2nd generation) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-)
iPad Pro (10.5-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--10-5-inch-)
iPad (6th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--6th-generation-)
iPad (7th generation) (com.apple.CoreSimulator.SimDeviceType.iPad--7th-generation-)
iPad Pro (11-inch) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--11-inch-)
iPad Pro (12.9-inch) (3rd generation) (com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---3rd-generation-)
iPad mini (5th generation) (com.apple.CoreSimulator.SimDeviceType.iPad-mini--5th-generation-)
iPad Air (3rd generation) (com.apple.CoreSimulator.SimDeviceType.iPad-Air--3rd-generation-)
Apple TV (com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p)
Apple TV 4K (com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-4K)
Apple TV 4K (at 1080p) (com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-1080p)
Apple Watch - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm)
Apple Watch - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm)
Apple Watch Series 2 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-38mm)
Apple Watch Series 2 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-42mm)
Apple Watch Series 3 - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-38mm)
Apple Watch Series 3 - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-42mm)
Apple Watch Series 4 - 40mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-40mm)
Apple Watch Series 4 - 44mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-44mm)
Apple Watch Series 5 - 40mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-5-40mm)
Apple Watch Series 5 - 44mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-5-44mm)
== Runtimes ==
iOS 13.3 (13.3 - 17C45) - com.apple.CoreSimulator.SimRuntime.iOS-13-3
tvOS 13.3 (13.3 - 17K446) - com.apple.CoreSimulator.SimRuntime.tvOS-13-3
watchOS 6.1 (6.1.1 - 17S445) - com.apple.CoreSimulator.SimRuntime.watchOS-6-1
== Devices ==
-- iOS 13.3 --
    iPhone 8 (54589698-0C9F-407D-B21A-83432CABB681) (Shutdown)
    iPhone 8 Plus (509B7103-97DB-4AB9-B829-001190ED4B7E) (Shutdown)
    iPhone 11 (509BC7C7-9C0E-42FA-8AB2-F5220EBAA13B) (Shutdown)
    iPhone 11 Pro (3E8E7E92-66F2-4AF3-A405-23B5FB231DE7) (Shutdown)
    iPhone 11 Pro Max (50C15135-1532-44C5-B82C-B327F88F2712) (Shutdown)
    iPad Pro (9.7-inch) (B11D5D40-FEA2-4114-B053-E4CFD29D127C) (Shutdown)
    iPad (7th generation) (7F8EDE89-74E0-4BAB-B3CA-09E2DAE1F095) (Shutdown)
    iPad Pro (11-inch) (04DD3B8A-5B78-48E8-8B22-56796A9CFB73) (Shutdown)
    iPad Pro (12.9-inch) (3rd generation) (D811684E-2F3E-4FC6-92EA-39301451F7E5) (Shutdown)
    iPad Air (3rd generation) (BBC48526-3922-4C97-BA14-B1888385243A) (Shutdown)
-- tvOS 13.3 --
    Apple TV (6680F059-4DE1-430C-B696-228AC27CAA88) (Shutdown)
    Apple TV 4K (048E58E8-6A27-4D81-BDEB-8812C610B756) (Shutdown)
    Apple TV 4K (at 1080p) (384D5E60-B6B1-481E-BDC3-B7FF8F773412) (Shutdown)
-- watchOS 6.1 --
    Apple Watch Series 4 - 40mm (1B98415B-3FDE-401B-A80C-A3551DB207D7) (Shutdown)
    Apple Watch Series 4 - 44mm (661838E9-B0BE-42B4-B55E-9A34263B1AEA) (Shutdown)
    Apple Watch Series 5 - 40mm (F76D77EF-0932-4164-94BB-9FC757420911) (Shutdown)
    Apple Watch Series 5 - 44mm (D86F0BD5-4D38-4537-9C8C-2F5C74E404CA) (Shutdown)
== Device Pairs ==
56795D8F-84E0-4F5A-BA60-517EF25593FF (active, disconnected)
    Watch: Apple Watch Series 5 - 40mm (F76D77EF-0932-4164-94BB-9FC757420911) (Shutdown)
    Phone: iPhone 11 Pro (3E8E7E92-66F2-4AF3-A405-23B5FB231DE7) (Shutdown)
4DDF7790-928A-4D86-B2BC-213F785F5188 (active, disconnected)
    Watch: Apple Watch Series 5 - 44mm (D86F0BD5-4D38-4537-9C8C-2F5C74E404CA) (Shutdown)
    Phone: iPhone 11 Pro Max (50C15135-1532-44C5-B82C-B327F88F2712) (Shutdown)

help语法

 crifan@licrifandeMacBook-Pro  ~  xcrun --help
Usage: xcrun [options] <tool name> ... arguments ...

Find and execute the named command line tool from the active developer
directory.

The active developer directory can be set using `xcode-select`, or via the
DEVELOPER_DIR environment variable. See the xcrun and xcode-select manual
pages for more information.

Options:
  -h, --help                  show this help message and exit
  --version                   show the xcrun version
  -v, --verbose               show verbose logging output
  --sdk <sdk name>            find the tool for the given SDK name
  --toolchain <name>          find the tool for the given toolchain
  -l, --log                   show commands to be executed (with --run)
  -f, --find                  only find and print the tool path
  -r, --run                   find and execute the tool (the default behavior)
  -n, --no-cache              do not use the lookup cache
  -k, --kill-cache            invalidate all existing cache entries
  --show-sdk-path             show selected SDK install path
  --show-sdk-version          show selected SDK version
  --show-sdk-build-version    show selected SDK build version
  --show-sdk-platform-path    show selected SDK platform path
  --show-sdk-platform-version show selected SDK platform version

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 10:01:04

Signing

Signing

TODO：

【基本解决】搞懂XCode中Signing中Code Signing相关参数的逻辑

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 09:39:40

iOS设备

iOS设备

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 09:38:34

iPhone

iPhone

TODO：

【已解决】XCode调试iOS的app到越狱iPhone报错：Could not launch failed to get the task for process

【未解决】XCode报错failed to get the task for process：换另外iPhone7试试

【未解决】尝试解决XCode报错failed to get the task for process：证书和签名方面

【未解决】尝试解决XCode报错failed to get the task for process：重置证书和签名

【未解决】尝试解决XCode报错failed to get the task for process：Provisioning Profile相关

【已解决】XCode编译安装iOS的app到iPhone报错：Unable to install

【已解决】尝试解决XCode报错failed to get the task for process：XCode版本重装或升级

【已解决】XCode调试iPhone报错：Failed to start remote service com.apple.debugserver on device

【已解决】XCode调试app再次报错：Unable to install

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 09:42:38

iOS Simulator

iOS Simulator

TODO：

【整理】Xcode中的iOS模拟器(iOS Simulator)的介绍和使用心得 – 在路上

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 11:16:12

日志

日志

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 10:37:32

调试运行

调试运行日志

XCode中可以拷贝出错误日志详情

XCode编译调试的log，看起来很少，很精简：

但是如果去Command+C拷贝粘贴出来，其实是完整的详细的内容：

Showing All Messages
CompileC /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/Objects-normal/arm64/LLDBTools.o /Users/crifan/dev/dev_root/company/deeper/youtube/XCode/YouTube_1708/block-youtube-ads/youtubeDylib/Tools/LLDBTools.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'youtubeDylib' from project 'youtube')
    cd /Users/crifan/dev/dev_root/company/deeper/youtube/XCode/YouTube_1708/block-youtube-ads
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -target arm64-apple-ios12.0 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu++1z -stdlib\=libc++ -fobjc-arc -fobjc-weak -fmodules -gmodules -fmodules-cache-path\=/Users/crifan/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/crifan/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wmissing-prototypes -Wdocumentation -Wunreachable-code -Wquoted-include-in-framework-header -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -DDEBUG\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Index/DataStore -iquote /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/youtubeDylib-generated-files.hmap -I/Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/youtubeDylib-own-target-headers.hmap -I/Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/youtubeDylib-all-target-headers.hmap -iquote /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/youtubeDylib-project-headers.hmap -I/Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Products/Debug-iphoneos/include -I/opt/MonkeyDev/include -I/opt/theos/vendor/include -I/opt/theos/vendor/include/.github -I/opt/theos/vendor/include/AVFoundation -I/opt/theos/vendor/include/AddressBookUI -I/opt/theos/vendor/include/AlienBlue -I/opt/theos/vendor/include/Anemone -I/opt/theos/vendor/include/AppKit -I/opt/theos/vendor/include/AppList -I/opt/theos/vendor/include/AppSupport -I/opt/theos/vendor/include/ApplePushService -I/opt/theos/vendor/include/AssertionServices -I/opt/theos/vendor/include/AssistantServices -I/opt/theos/vendor/include/BackBoardServices -I/opt/theos/vendor/include/BaseBoard -I/opt/theos/vendor/include/BaseBoardUI -I/opt/theos/vendor/include/BatteryCenter -I/opt/theos/vendor/include/BiometricKit -I/opt/theos/vendor/include/BiteSMS -I/opt/theos/vendor/include/BluetoothManager -I/opt/theos/vendor/include/BulletinBoard -I/opt/theos/vendor/include/CameraKit -I/opt/theos/vendor/include/CameraUI -I/opt/theos/vendor/include/CaptainHook -I/opt/theos/vendor/include/Celestial -I/opt/theos/vendor/include/ChatKit -I/opt/theos/vendor/include/Contacts -I/opt/theos/vendor/include/ControlCenterUIKit -I/opt/theos/vendor/include/CoreFoundation -I/opt/theos/vendor/include/Flipswitch -I/opt/theos/vendor/include/Foundation -I/opt/theos/vendor/include/FrontBoard -I/opt/theos/vendor/include/FrontBoardServices -I/opt/theos/vendor/include/GeoServices -I/opt/theos/vendor/include/GraphicsServices -I/opt/theos/vendor/include/IMCore -I/opt/theos/vendor/include/IMDaemonCore -I/opt/theos/vendor/include/IMFoundation -I/opt/theos/vendor/include/IMSharedUtilities -I/opt/theos/vendor/include/IOKit -I/opt/theos/vendor/include/IconSupport -I/opt/theos/vendor/include/Jasmine -I/opt/theos/vendor/include/LightMessaging -I/opt/theos/vendor/include/MapKit -I/opt/theos/vendor/include/MaterialKit -I/opt/theos/vendor/include/MediaPlayer -I/opt/theos/vendor/include/MediaPlayerUI -I/opt/theos/vendor/include/MediaRemote -I/opt/theos/vendor/include/MobileCoreServices -I/opt/theos/vendor/include/MobileGestalt -I/opt/theos/vendor/include/MobileIcons -I/opt/theos/vendor/include/MobilePhone -I/opt/theos/vendor/include/MobileSMS -I/opt/theos/vendor/include/MobileTimer -I/opt/theos/vendor/include/OnBoardingKit -I/opt/theos/vendor/include/Pandora -I/opt/theos/vendor/include/PassKitUI -I/opt/theos/vendor/include/PassKitUIFoundation -I/opt/theos/vendor/include/PersistentConnection -I/opt/theos/vendor/include/PersonaKit -I/opt/theos/vendor/include/PersonaUI -I/opt/theos/vendor/include/PhotoLibrary -I/opt/theos/vendor/include/PhotoLibraryServices -I/opt/theos/vendor/include/PhotosUI -I/opt/theos/vendor/include/Preferences -I/opt/theos/vendor/include/PreferencesUI -I/opt/theos/vendor/include/QuartzCore -I/opt/theos/vendor/include/SplashBoard -I/opt/theos/vendor/include/SpringBoard -I/opt/theos/vendor/include/SpringBoardFoundation -I/opt/theos/vendor/include/SpringBoardHome -I/opt/theos/vendor/include/SpringBoardServices -I/opt/theos/vendor/include/SpringBoardUI -I/opt/theos/vendor/include/SpringBoardUIServices -I/opt/theos/vendor/include/StoreKitUI -I/opt/theos/vendor/include/TechSupport -I/opt/theos/vendor/include/TelephonyUI -I/opt/theos/vendor/include/TextInput -I/opt/theos/vendor/include/Tweetbot -I/opt/theos/vendor/include/TwitkaFly -I/opt/theos/vendor/include/UIFoundation -I/opt/theos/vendor/include/UIKit -I/opt/theos/vendor/include/UserNotificationsKit -I/opt/theos/vendor/include/UserNotificationsUIKit -I/opt/theos/vendor/include/Velox -I/opt/theos/vendor/include/auki -I/opt/theos/vendor/include/installd -I/opt/theos/vendor/include/libactivator -I/opt/theos/vendor/include/libarchive -I/opt/theos/vendor/include/libpackageinfo -I/opt/theos/vendor/include/libprefs -I/opt/theos/vendor/include/libstatusbar -I/opt/theos/vendor/include/libundirect -I/opt/theos/vendor/include/logos -I/opt/theos/vendor/include/objc -I/opt/theos/vendor/include/openssl -I/opt/theos/vendor/include/rocketbootstrap -I/opt/theos/vendor/include/theos -I/opt/theos/vendor/include/IOKit/hid -I/opt/theos/vendor/include/IOKit/ps -I/opt/theos/vendor/include/IOKit/pwr_mgt -I/Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/DerivedSources-normal/arm64 -I/Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/DerivedSources/arm64 -I/Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/DerivedSources -F/Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Products/Debug-iphoneos -F/opt/MonkeyDev/Frameworks -F/opt/MonkeyDev/Frameworks/RevealServer.framework -F/opt/MonkeyDev/Frameworks/RevealServer.framework/Modules -F/opt/MonkeyDev/Librarys -F/opt/theos/vendor/lib -DTHEOS_INSTANCE_NAME\=\"youtubeDylib\" -include /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/PrecompiledHeaders/SharedPrecompiledHeaders/11491367307218202437/youtubeDylib-Prefix.pch -MMD -MT dependencies -MF /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/Objects-normal/arm64/LLDBTools.d --serialize-diagnostics /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/Objects-normal/arm64/LLDBTools.dia -c /Users/crifan/dev/dev_root/company/deeper/youtube/XCode/YouTube_1708/block-youtube-ads/youtubeDylib/Tools/LLDBTools.mm -o /Users/crifan/Library/Developer/Xcode/DerivedData/youtube-akcbcgavyfjcpkfbbowmtledboux/Build/Intermediates.noindex/youtube.build/Debug-iphoneos/youtubeDylib.build/Objects-normal/arm64/LLDBTools.o

XCode可以展开错误看细节

其实点击报错，是可以展开看到具体错误信息的：

选中当前错误的行：

拷贝出错误的本身的日志：

Showing Recent Messages
/Users/crifan/dev/DevRoot/zry/iOS_tweak/iOSOpenDev/xxx/xxx/xxx.xm:66:18: No matching function for call to ‘strcpy'

展开后，选中详情：

可以粘贴处具体错误详情日志：

Showing Recent Messages
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/string.h:79:7: Candidate function not viable: cannot convert argument of incomplete type 'void *' to 'char *' for 1st argument

后记：

其实左边错误信息中，已列出此具体错误原因了：

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 11:10:55

崩溃

崩溃日志

TODO：

【已解决】如何把iOS的app的崩溃日志中的地址转换成符号即符号化

【已解决】XCode中解析出iPhone中崩溃日志的symbol符号函数信息

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 10:38:20

其他

其他

TODO：

项目版本兼容

【已解决】自己Mac中打开Xcode项目报错：The project cannot be opened because it is in a future Xcode project file format

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 09:43:57

子教程

子教程

Xcode开发中的部分子领域的内容，已整理到独立的子教程中：

调试相关：Xcode开发：调试心得

用的调试器：主流调试器：LLDB

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2023-07-13 21:49:07

附录

附录

下面列出相关参考资料。

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 09:33:53

参考资料

参考资料

【记录】Mac中安装XCode

【已解决】Win中VMWare中macOS中安装和使用XCode

Xcodebuild命令使用 - 滴水微澜 - 博客园

ios - What are the differences between xcodebuild, xcrun and swift command line tools? - Stack Overflow

iOS 自动构建命令——xcodebuild - 简书

深入淺出 Xcode 命令列 - xcrun - 掘金

man page xcodebuild section 1

Technical Note TN2339: Building from the Command Line with Xcode FAQ

crifan.org，使用署名4.0国际(CC BY 4.0)协议发布 all right reserved，powered by Gitbook最后更新： 2022-11-03 11:13:40