Detect TestFlight?

后端 未结 3 1524
暖寄归人
暖寄归人 2020-12-10 03:14

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

3条回答
  •  抹茶落季
    2020-12-10 04:10

    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.

提交回复
热议问题