Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 417
Darshan Kunjadiya Avatar asked Mar 04 '23 03:03

Darshan Kunjadiya


1 Answers

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"
}
like image 186
Darshan Kunjadiya Avatar answered May 03 '23 16:05

Darshan Kunjadiya