Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if iOS app is live in app store

Is it possible somehow to code like below in iOS app ?

if(app is live in app store)
{
   //Do something
}
else
{
  //Do other thing
}

I wanted to avoid cases where our QE/Dev team is using app for testing. Is there a way I can detect how app code is signed (Developer/Adhoc/Distribution) to check ? Even if it is possible, it will not eliminate cases when Apple is using our app for testing as part of review. We recorded many downloads of our content by Apple before our app goes live in App store.

like image 387
msk Avatar asked Mar 28 '12 11:03

msk


People also ask

How do I know if an app is in the App Store?

At the top right, tap the profile icon. Tap Manage apps & device. Apps with an update available are labeled "Update available."

How can I check if an app is installed from a Web page on an iPhone?

Show activity on this post. iOS Safari has a feature that allows you to add a "smart" banner to your webpage that will link either to your app, if it is installed, or to the App Store. You do this by adding a meta tag to the page.


2 Answers

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.

Like this:

if ([[NSBundle mainBundle] pathForResource:@"embedded"
                                    ofType:@"mobileprovision"]) {
  // not from app store (Apple's reviewers seem to hit this path)
} else {
  // from app store
}

This technique is from the HockeyApp SDK. I personally have applications in the store that use this technique, and of course there are many apps distributed that include the HockeyApp SDK.

Based on an immediate crash I accidentally released in a particular build of my application in the "from app store" path, Apple's team will follow the "not from app store" path. Let my loss be your gain on that one. :)

like image 128
Steven Fisher Avatar answered Oct 02 '22 01:10

Steven Fisher


On iOS 7 and later, you may also be able to check:

if ([NSData dataWithContentsOfURL:[NSBundle mainBundle].appStoreReceiptURL] != nil) {
    // Downloaded from App Store
} else {
    // Not downloaded from App Store
}
like image 27
Frank Schmitt Avatar answered Oct 02 '22 01:10

Frank Schmitt