Search code examples
iosobjective-cswifttestflight

How can I programmatically check if an app is running in TestFlight beta mode?


Is there a way to programmatically determine if the installed version of an iOS came from TestFlight (beta) or production (App Store)? To simplify testing of in-app purchases, I'd like to disable the entire store flow for beta testers.

Bonus points for providing the answer in both Objective-C and Swift.


Solution

  • Try this code:

        if ([[NSBundle mainBundle] pathForResource:@"embedded"
                                            ofType:@"mobileprovision"]) {
          // not from app store, eg: testflight or others
        } else {
          // from app store
    
    }
    

    Refferece answer from here