Xcode文档离线安装

在 Xcode 中下载安装文档速度太慢了,不得已只得自行下载,然后再手动安装。

  1. 首先在 https://developer.apple.com/library/downloads/docset-index.dvtdownloadableindex 找到需要下载的文档的下载地址。

这里我需要下载的是 iOS 9.2 的文档,内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!-- START iOS doc set -->
<dict>
<key>fileSize</key>
<integer>1071665431</integer>
<key>identifier</key>
<string>com.apple.adc.documentation.iOS</string>
<key>name</key>
<string>iOS 9.2 Documentation</string>
<key>source</key>
<string>https://devimages.apple.com.edgekey.net/docsets/20151208/031-43202-A.dmg</string>
<key>userInfo</key>
<dict>
<key>ActivationPredicate</key>
<string>$XCODE_VERSION &gt;= '7.2'</string>
<key>Category</key>
<string>Documentation</string>
<key>IconType</key>
<string>IDEDownloadablesTypeDocSet</string>
<key>InstallPrefix</key>
<string>$(HOME)/Library/Developer/Shared/Documentation/DocSets</string>
<key>InstalledIfAllReceiptsArePresentOrNewer</key>
<dict>
<key>com.apple.pkg.7.0.iOSDocset</key>
<string>10.9.0.0.1.1449203766</string>
</dict>
<key>RequiresADCAuthentication</key>
<false/>
<key>Summary</key>
<string>My description of content</string>
</dict>
<key>version</key>
<string>92.7</string>
</dict>
<!-- END iOS doc set -->

下载地址为: https://devimages.apple.com.edgekey.net/docsets/20151208/031-43202-A.dmg

如果觉得官网下载速度太慢了,也可以从我的百度网盘下载: http://pan.baidu.com/s/1pKsmkY3 。下载完成之后自行进行文件合并、md5校验。

  1. 将下载的 dmg 文件移动到 ~/Library/Caches/com.apple.dt.Xcode/Downloads/ 目录下(如果目录不存在,自行创建),
    并重命名为 <identifier>-<version>.dmg 这样的形式,在这里为: com.apple.adc.documentation.iOS-92.7.dmg

然后转到文档所在目录: ~/Library/Developer/Shared/Documentation/DocSets,如果对应的文档文件已存在则删除。
rm -rf com.apple.adc.documentation.iOS.docset

  1. 打开 Xcode ,点击下载对应的文档。此时应该会跳过下载步骤而直接进行安装。

Xcode