Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect TestFlight?

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.

like image 366
Steven Fisher Avatar asked Sep 14 '12 21:09

Steven Fisher


People also ask

How do I check my TestFlight app?

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.

Is TestFlight tied to Apple ID?

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...).

Can you use TestFlight under 13?

TestFlight says minimum age is 13 … Apple Developer Forums.


2 Answers

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

like image 122
LorenzoValentijn Avatar answered Sep 18 '22 15:09

LorenzoValentijn


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.

like image 36
Steven Fisher Avatar answered Sep 21 '22 15:09

Steven Fisher