原文链接
作者:C4 开源项目
译者:Crystal Sun
全部章节请关注此文集C4教程翻译
校对后的内容请看这里
这是本文集的最后一篇文章,也是教程里的最后一篇文章,看到这里,估计对如何使用 C4,已经有了一个大体的了解了。
最后一个任务是将 COSMOS 提交到应用市场。
Profiling 配置文件
第一步是给应用配置文件,在 Xcode 中,点击
CM+I
…或者选择:Product > Profile

这样就打开了 Instruments。
选择 Allocations 工具然后运行 App。

App 启动了,我随便用了一会,接着我停止了 Profiling,看看哪些地方的分配增长了,增长了多少等等……

我还是简单解释一下比较好:
我看到总的分配数非常多,不过只有 23.5 MB 是持久性分配,这些分配都在 All Heap & Anonymous VM 里。
进入 All Heap & Anonymous VM,把这些分配按照自身大小排序。
排在第一位的分配是 16 MB,不过看起来像是系统自带的东西,所以我暂时先不管它。
接下来第二位的分配看起来像是图片、音频文件,然后从这之后分配的大小就变得非常小了(到了第十一行,都小于 100 kb)。
我知道我放了一个很大的启动图片,还有很多小的星星图片以及装饰图片,等等。所以,31 MB 比较正常无需我担心,可以继续往下操作了。
接着运行 Leaks,结果没有发生什么有趣的事情。
我分析了一下 App,Xcode 没有给我警告,也没有提示有潜在的问题……

所以,我现在十分确定,我可以把应用上传到应用市场上了。
iTunes Connect
我用我的开发者帐号登录 �iTunes Connect,选择 My Apps。

接下来创建新的 App……

开始填写所需的信息……

……不过当我填写到 Bundle ID 部分时,我想起来我还没有给 App 设置相关代码呢。
App ID & Profile
所以我登录我的开发者帐号,创建一个新的 App ID……

……它的 identifier 是 com.c4ios.COSMOS。

接着我创建了新的 provisioning profile,用来分发到应用市场……

这个 App ID 也就是刚刚我创建的那个 App……

Xcode
回到 Xcode,打开菜单栏上的 prferences,点击 Accounts。双击我的账户,看到 Xcode 已经看到了我刚刚在网上创建的新的配置文件了。

点击配置文件旁边的 download 按钮,下载安装,然后找到 Build Settings,在 Code Signing 部分,把配置文件改成 COSMOS……

接着,我把 code signing identity 改成我的主账号……

然后,我尝试 Archive 该工程,不过我收到了错误警告,说我的 Bundle Identifier 是错误的。
所以,到工程的 .plist 文件中把 bundle identifier 改成我在 provisioning profile 时使用的那个。

……到工程的 Build Settings 中的 Packaging 完成同样的操作……

再次 archive 工程,又收到了另外一个错误警告,说:
Entitlements file do not match those specified in your provisioning profile.(0xE8008016)
所以,我到 Stack Overflow 上搜索一下如何解决这个问题……
看完答案后我回到 Xcode,更新工程里的 Capabilities 部分中的 Game Center 和 In-app Purchases……

这样看起来好像解决问题了,我模糊记得这两个部分的 App ID 默认值就是我创建的(我不能不选它们)。

所以,再次 archive……

这次成功了,不过,当我上传到应用市场时,我又收到了一个错误提示:

所以,我把设置中的 version 改成 1.2……

archive 然后再次上传,看起来好像成功了!

接着,上传完成,我还是收到了错误警告……

我觉得,这个警告的意思是,发现这个 App 使用了自定义的 C4 API,需要有人来审核一下我的 App,因为到目前位置,机器还没有比人类更聪明。
iTunes Connect (again)
所以,我回到 iTunes Connect,检查我刚刚上传的 App 的状态。

上面说 App 目前处于 “Processing” 的状态,我不明白这是什么意思……不过我知道,我得等待一段时间了。
所以,我开始写出详细步骤……
当我写完这部分时,我看到状态已经不是 processing 了。

我选择 new build,然后更新 Test 信息。

删除旧版本的 COSMOS,从 App Store 的 tab 页上选择 new build。


然后把版本号改成 1.2,提交申请。
出现一些确认信息的对话框,然后 App 上传了,等待人工审核。

这是星期天的下午……
Launch
COSMOS 在我提交申请到几天后通过了审核,我们需要时间来建设我们的网站,在 11 月 23 日,我们上线了。
注释解释:
- 我并不是现在写的这篇文章,因为我在六月份的时候上传过一个版本。不过,我想添加这一步以供你参考,之前的应用是用旧版本的 C4 写的,所以我需要彻底重写代码……现在已经十月了。
- 我实际上做的是1.1,不过我还是得到了同样的错误警告,因为这里已经有了1.1了,就是六月份发布的那个版本,我忘了这个版本了。
- 一旦你看到上传的进度条,就意味着你终于把设置对了相关信息,App 可以上传了。
- 我截屏了,所以在上传的这段时间,我可以用来写这篇文章。
本文由 SwiftGG 翻译组翻译,已经获得作者翻译授权。