TestFlight 是一款在 2014 年被苹果收购的 iOS 测试工具.
开发者可以通过 TestFlight 来邀请用户协助测试 App, 待 App 完善之后, 再提交正式版到 App Store, 这对于开发者和用户来说都是有益处的.
2018 年 9 月 26 日, 支持通过 App Store Connect 生成一个公开的链接, 邀请 TestFlight 测试者.
TestFlight 的限制和特点:
需要运行在 iOS8 及以上版本的设备上
需要安装 TestFlight App
有效时间 (90 天)
测试人员有最大上限 (最多 10000)
TestFlight 版本, 可以提交反馈
TestFlight 版本, 需要审核 (1 天左右)
TestFlight 版本, 可以生成公开链接 ( https://testflight.apple.com/join/xxxxxx )
TestFlight 版本, 可以修改公开链接直接跳转 TestFlight 安装 App( itms-beta://testflight.apple.com/join/xxxxxx )
1. 如何安装 Beta 版 App?
在要用于测试的 iOS 设备上安装 TestFlight.
在 iOS 设备上打开您的邀请电子邮件或轻点公开链接.
轻点 View in TestFlight(在 TestFlight 中查看) 或 Start Testing(开始测试); 或者, 针对您想要测试的 App 轻点 Accept(接受),Install(安装) 或 Update(更新).
2. 如何判断是否已经安装了 TestFlight ?
通常我们会用 UIApplication 的 canOpenURL: 方法判断其他 App 是否安装.
iOS9 限制了 openURL: 和 canOpenURL: 方法的使用, 如果我们要调起第三方 App, 需要在 Info.plist 的 LSApplicationQueriesSchemes Key 中添加相应 App 的 Scheme 才行, 且添加的 Scheme 个数不能超过 50 个.
- // iOS 原生代码
- // 通过 itms-bata:// 来判断 TestFlight 是否安装
- NSString *customAppString = @"itms-beta://";
- if ([[UIApplication sharedApplication] canOpenURL:customAppURL]) {
- // TestFlight 已经安装
- } else {
- // TestFlight 没有安装
- }
3. 如何实现点击 App 内邀请按钮, 跳转 TestFlight 安装 Beta 版 App ?
虽然有了 TestFlight 公开链接, 大大减少了以往 TestFlight 安装 App 的复杂度, 但是还是不够简化, 我们要做的是通过在 App 内, 给灰度用户一个提示框, 用户点击之后跳转 TestFlight 直接安装 App.
1, 进入 App Store Content https://appstoreconnect.apple.com/login , 输入 Apple 开发者账号登录.
2, 登录成功之后, 选择 "我的 App", 进入 App 列表.(如果没有 App, 需要创建 App)
3, 选择 "TestFlight","新群组","构建版本","选择要测试的构建版本","测试信息", 提交审核.
4, 审核通过之后, 选择 "开启链接", 将 "https" 替换成 "itms-beta" 即可.
[TestFlight 公开链接] 转 [TestFlight 安装链接]
- // TestFlight 公开链接
- https://testflight.apple.com/join/xxxxxx
- // TestFlight 安装链接
- itms-beta://testflight.apple.com/join/xxxxxx
iOS 跳转 TestFlight 实现
- // iOS 原生代码
- NSString *customAppString = @"itms-beta://";
- if ([[UIApplication sharedApplication] canOpenURL:customAppURL]) {
- // TestFlight 已经安装, 打开 TestFlight 安装 App 页面
- customAppString = @"itms-beta://testflight.apple.com/join/xxxxxx";
- } else {
- // TestFlight 没有安装, 打开 AppStore 安装 TestFlight 页面
- customAppString = @"https://itunes.apple.com/cn/app/testflight/id899247664?mt=8";
- }
- NSURL *customAppURL = [NSURL URLWithString:customAppString];
- [[UIApplication sharedApplication] openURL:customAppURL
- options:@{}
- completionHandler:nil];
4. 实现发起灰度发布邀请
前台:
邀请弹框
检测用户是否为灰度用户
检测灰度版本是否忽略
检测灰度版本是否可用 (多个条取最高版本)
- // 前端页面 JavaScript 部分代码
- // 点击下载灰度 App
- // 说明:
- // Android 链接: http://darendian.showjoy.com/appgray/xxxxxx.apk
- // iOS 链接: itms-beta://testflight.apple.com/join/xxxxxx
- clickPublicBetaBtn() {
- const self = this;
- if (self.isweb) {
- shopModal.toast({ message: '请在 App 内打开' });
- return;
- }
- const downloadURL = self.isIOS ? self.betaData.iOS : self.betaData.Android;
- if (self.isAndroid) {
- // weex Android 接口 (打开系统浏览器)
- shopBase.openBrowser(downloadURL);
- } else {
- // weex iOS 接口 (调用 openURL)
- shopBase.openApp(downloadURL);
- }
- },
后台:
后台配置邀请信息, 下载链接, 目标用户, 以及灰度 App 版本号, 配置多项目时, 取最高的 App 版本, 且高版本灰度 App 包含低版本的所有内容.
配置平台
来源: http://www.jianshu.com/p/4a644d9f3260