用途
asc-iris 是 asc CLI 工具的一个技能,用于访问 App Store Connect 私有 API(iris)端点。iris API 支撑着 App Store Connect 网页界面,并暴露了公开 REST API 所不具备的能力,例如创建应用。
认证方式
Iris 使用浏览器 Cookie,而非 JWT API 密钥。有两种解析方法:
- 浏览器自动提取(默认):在 Chrome/Safari/Firefox 中登录 appstoreconnect.apple.com,Cookie 会通过 SweetCookieKit 自动提取。
- 环境变量:为 CI/CD 设置 ASC_IRIS_COOKIES:
export ASC_IRIS_COOKIES="myacinfo=DAWT...; itctx=eyJ..."
关键 Cookie 是 myacinfo(设置在 .apple.com 上)。其他 Cookie(itctx、dqsid、wosid)从 appstoreconnect.apple.com 收集。
导航方式(CAEOAS Affordances)
每个 JSON 响应都包含一个 "affordances" 字段,其中带有可直接运行的命令:
{
"source": "browser",
"cookieCount": 5,
"affordances": {
"listApps": "asc iris apps list",
"createApp": "asc iris apps create --name <name> --bundle-id <id> --sku <sku>"
}
}
命令
status — 检查 iris 会话
asc iris status --pretty
输出:
{
"data": [{
"affordances": {
"createApp": "asc iris apps create --name <name> --bundle-id <id> --sku <sku>",
"listApps": "asc iris apps list"
},
"cookieCount": 5,
"source": "browser"
}]
}
如果未找到 Cookie,错误消息会建议登录 appstoreconnect.apple.com 或设置 ASC_IRIS_COOKIES。
apps list — 列出所有应用
asc iris apps list --pretty
输出:
{
"data": [{
"affordances": {
"listAppInfos": "asc app-infos list --app-id 1234567890",
"listVersions": "asc versions list --app-id 1234567890"
},
"bundleId": "com.example.app",
"id": "1234567890",
"name": "My App",
"platforms": ["IOS"],
"primaryLocale": "en-US",
"sku": "MYSKU"
}]
}
apps create — 创建新应用
asc iris apps create \
--name "My App" \
--bundle-id com.example.app \
--sku com.example.app \
[--primary-locale en-US] \
[--platforms IOS] \
[--version 1.0] \
--pretty
| 标志 | 必需 | 默认值 | 描述 |
|---|---|---|---|
| --name | ✅ | — | 应用名称(显示在 App Store 上) |
| --bundle-id | ✅ | — | Bundle 标识符(必须匹配已注册的 Bundle ID) |
| --sku | ✅ | — | SKU 标识符(在你的账户内唯一) |
| --primary-locale | ❌ | en-US | 主要语言环境 |
| --platforms | ❌ | IOS | 一个或多个:IOS、MAC_OS |
| --version | ❌ | 1.0 | 初始版本字符串 |
多平台示例:
asc iris apps create \
--name "My Universal App" \
--bundle-id com.example.universal \
--sku com.example.universal \
--platforms IOS MAC_OS \
--version 2.0 \
--pretty
重要:--bundle-id 必须引用已注册的 Bundle 标识符。如有需要,先用 asc bundle-ids register 注册一个。
resolution-center get — 读取 App Review 的拒绝消息
官方 API 仅报告提交存在 UNRESOLVED_ISSUES;审核员的消息文本和准则引用仅 iris 提供。当提交或被拒绝项显示 getResolutionDetails affordance 时,运行:
asc iris resolution-center get --submission-id <SUBMISSION_ID> --plain-text --pretty
asc iris resolution-center get --submission-id <SUBMISSION_ID> --out ./rc-attachments # 同时下载附件
返回 Resolution Center 线程:messages[](审核员文本,fromActor 为 APPLE/USER)、rejectionReasons[](准则章节/代码/描述),以及当 App Review 附加文件时的 attachments[](--out <dir> 会下载它们)。完整文档:docs/features/resolution-center.md
典型工作流
# 1. 检查是否已登录
asc iris status --pretty
# 2. 创建新应用
asc iris apps create \
--name "My New App" \
--bundle-id com.example.newapp \
--sku com.example.newapp \
--pretty
# 3. 继续使用公开 API 命令(使用步骤 2 中的应用 ID)
asc versions list --app-id <id>
asc app-infos list --app-id <id>
故障排除
"No App Store Connect cookies found"
- 确保你已在浏览器中登录 appstoreconnect.apple.com
- 如果使用 Chrome,CLI 需要 Keychain 访问权限来解密 Cookie——在提示时授予访问权限
- 对于 CI/CD,设置 ASC_IRIS_COOKIES 并提供 Cookie 字符串
409 ENTITY_ERROR.INCLUDED.INVALID_ID
- 创建请求中的占位符 ID 必须使用 ${local-id} 格式——CLI 会自动处理
iris apps list 返回空结果
- 如果尚未创建任何应用,这是正常的——使用 asc iris apps create 创建一个
适用场景
- 需要通过私有 API 创建 App Store Connect 应用
- 需要读取 App Review 的拒绝消息、准则引用和附件
- 需要在 CI/CD 环境中通过环境变量进行 Cookie 认证
限制
- 依赖浏览器 Cookie 或环境变量,Cookie 可能过期
- Chrome 需要 Keychain 访问权限
- 创建应用时 --bundle-id 必须引用已注册的 Bundle 标识符