如何在运行时告知iOS应用程序是否正在通过TestFlight Beta安装运行 [英] How to tell at runtime whether an iOS app is running through a TestFlight Beta install
问题描述
是否可以在运行时检测到已通过TestFlight Beta(通过iTunes Connect提交)与App Store安装了应用程序?您可以提交单个应用程序包并通过它们提供。是否有可以检测安装方式的API?或收据是否包含允许确定此信息的信息?
Is it possible to detect at runtime that an application has been installed through TestFlight Beta (submitted through iTunes Connect) vs the App Store? You can submit a single app bundle and have it available through both. Is there an API that can detect which way it was installed? Or does the receipt contain information that allows this to be determined?
推荐答案
对于通过TestFlight Beta安装的应用程序,收据文件已命名 StoreKit \sandboxReceipt
与通常的 StoreKit \receipt
相比。使用 [NSBundle appStoreReceiptURL]
,您可以在URL的末尾查找sandboxReceipt。
For an application installed through TestFlight Beta the receipt file is named StoreKit\sandboxReceipt
vs the usual StoreKit\receipt
. Using [NSBundle appStoreReceiptURL]
you can look for sandboxReceipt at the end of the URL.
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSString *receiptURLString = [receiptURL path];
BOOL isRunningTestFlightBeta = ([receiptURLString rangeOfString:@"sandboxReceipt"].location != NSNotFound);
请注意 sandboxReceipt
也是在本地运行构建时的接收文件以及在模拟器中运行的构建。
Note that sandboxReceipt
is also the name of the receipt file when running builds locally and for builds run in the simulator.
这篇关于如何在运行时告知iOS应用程序是否正在通过TestFlight Beta安装运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!