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

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

问题描述

在过去,我已经通过TestFlight分发了生产和测试版本的单独构建配置。这样可以轻松修改测试版本,例如公开应用程序的其他设置,让测试人员更全面地测试并查看有关应用状态的更多技术信息。



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

解决方案

这适用于:

  if([[NSBundle mainBundle] pathForResource:@embeddedofType: mobileprovision]){
// TestFlight
} else {
// App Store(和Apple审核者)
}



更新



似乎工作了,苹果改变了他们签署TestFlight构建的方式。这不会工作:

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


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.

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.

解决方案

This works:

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

Update

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"];

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

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