Search code examples
iosapp-storetestflight

How to know installed application is installed via TestFlight or AppStore?


I want to know about how to check user installed application is installed via Testflight or AppStore. So based on that I want to make some environmental change in whole application.

Is there anyway to find that by coding. Is Apple is providing any API for it?

Any help will be appreciated.


Solution

  • I found little snippet about how to know if application is installed via TestFlight.

    Here, appStoreReceiptURL is an instance property, which we can find from main bundle.

    enter image description here

    func isTestFlight() -> Bool {
        guard let appStoreReceiptURL = Bundle.main.appStoreReceiptURL else {
        return false
        }
        return appStoreReceiptURL.lastPathComponent == "sandboxReceipt"
    }