- Method 1
if ([[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) {
// 下载自TestFlight
} else {
// 下载自App Store (and Apple reviewers too)
}
- Method 2
BOOL isDownLoadFromTestFlightBeta = [[[[NSBundle mainBundle] appStoreReceiptURL] lastPathComponent] isEqualToString:@"sandboxReceipt"];
Swift
/// 是否是 testflight包
public static var isTestFlight: Bool {
return isAppStoreReceiptSandbox && !hasEmbeddedMobileProvision
}
/// 是否是 Appstore 包
public static var isAppStore: Bool {
return isAppStoreReceiptSandbox || hasEmbeddedMobileProvision ? false : true
}
fileprivate static var isAppStoreReceiptSandbox: Bool {
return Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
}
fileprivate static var hasEmbeddedMobileProvision: Bool {
return Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") != nil
}
网友评论