I would prefer to use the same build configuration for TestFlight vs. App Store. Is there a way to detect at runtime whether the app has been installed via TestFlight or the App Store? (My thinking is I'll only call takeOff
if it's not installed via the App Store.)
I want to avoid using TestFlight in App Store builds to protect my users' privacy, and also to avoid the potential derailing of networking discussed here.
Testing iMessage apps (iOS or iPadOS 10, or later) Install TestFlight on the iOS or iPadOS device that you'll use for testing. Open your email invitation or tap the public link on your iOS or iPadOS device. Tap View in TestFlight or Start Testing; or tap Install or Update for the app you want to test.
Test Flight is now linked via your Apple ID that's signed into the device at the top. This was running on iPad with OS 14.3. It's the same as on iPhone as well with that newer version as well. Go to Settings -> Top Link (name, icon, Apple ID, iCloud...).
TestFlight says minimum age is 13 … Apple Developer Forums.
To determine Debug, TestFlight or AppStore deployment in Swift:
private static let isTestFlight = NSBundle.mainBundle().appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
// This can be used to add debug statements.
static var isDebug: Bool {
#if DEBUG
return true
#else
return false
#endif
}
Complete source and sample: https://stackoverflow.com/a/33830605/639227
I believe this to be close enough to a duplicate of Check if iOS app is live in app store that this can be closed.
You can determine if your app was distributed via the app store by checking for the absence of embedded.mobileprovision. This file is only included in adhoc builds. It follows that if you're distributing builds only via TestFlight or HockeyApp and it is not a store build, it must be a TestFlight or HockeyApp build.
Like this:
if ([[NSBundle mainBundle] pathForResource:@"embedded"
ofType:@"mobileprovision"]) {
// not from app store
} else {
// from app store
}
This technique is from the HockeyApp SDK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With