問題描述
是否可以在 iOS 應用程序中以某種方式編寫如下代碼?
Is it possible somehow to code like below in iOS app ?
if(app is live in app store)
{
//Do something
}
else
{
//Do other thing
}
我想避免我們的 QE/Dev 團隊使用應用程序進行測試的情況.有沒有一種方法可以檢測應用程序代碼的簽名方式(開發人員/臨時/分發)來檢查?即使有可能,它也不會消除 Apple 使用我們的應用程序進行測試作為審查的一部分的情況.在我們的應用在 App Store 上線之前,我們記錄了 Apple 對我們內容的多次下載.
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.
推薦答案
您可以通過檢查是否缺少 embedded.mobileprovision 來確定您的應用是否通過應用商店分發.此文件僅包含在臨時構建中.
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.
像這樣:
if ([[NSBundle mainBundle] pathForResource:@"embedded"
ofType:@"mobileprovision"]) {
// not from app store (Apple's reviewers seem to hit this path)
} else {
// from app store
}
這項技術來自 HockeyApp SDK.我個人在商店中有使用這種技術的應用程序,當然還有許多分發的應用程序包括 HockeyApp SDK.
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.
基于我在來自應用商店"路徑中的特定應用程序版本中意外發布的即時崩潰,Apple 團隊將遵循不是來自應用商店"路徑.讓我的損失成為你的收獲.:)
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. :)
這篇關于檢查iOS應用是否在應用商店中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!