Check if iOS app is live in app store

前端 未结 6 1254
迷失自我
迷失自我 2020-12-28 19:23

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 wan

6条回答
  •  伪装坚强ぢ
    2020-12-28 19:58

    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. :)

提交回复
热议问题