检测是否从 Apple 的 Testflight 下载了 iOS 应用程序 [英] Detect if iOS App is Downloaded from Apple's Testflight

查看:34
本文介绍了检测是否从 Apple 的 Testflight 下载了 iOS 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去,我为通过 TestFlight 分发的生产和 Beta 版本使用了单独的构建配置.这样可以轻松修改 Beta 版本,例如公开应用的其他设置,让测试人员更彻底地测试事物并查看有关应用状态的更多技术信息.

In the past I've had separate build configurations for production and beta builds distributed through TestFlight. This made it easy to make modifications to beta builds, such as exposing additional settings the app to let testers test things more thoroughly and see more technical information about the status of the app.

有没有办法检查应用程序是否已通过 Apple 的 TestFlight 分发以更改应用程序的运行方式?编译器指令不再有意义,因为相同的构建可以分发给 Beta 测试人员并提交给商店,但也许有一种方法可以在运行时进行检查.

Is there a way to check if an app has been distributed through Apple's TestFlight to make changes to how the app runs? Compiler directives no longer make sense as the same build can be distributed to beta testers and submitted to the store, but perhaps there's a way to check at runtime.

推荐答案

这有效:

if ([[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) {
    // TestFlight
} else {
    // App Store (and Apple reviewers too)
}

更新

上述方法似乎不再有效,Apple 改变了他们签署 TestFlight 版本的方式.但这确实有效:

The above method doesn't seem to work anymore, Apple changed the way they sign TestFlight builds. This does work however:

BOOL isRunningTestFlightBeta = [[[[NSBundle mainBundle] appStoreReceiptURL] lastPathComponent] isEqualToString:@"sandboxReceipt"];

这篇关于检测是否从 Apple 的 Testflight 下载了 iOS 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆