Check if iOS app is live in app store

前端 未结 6 1252
迷失自我
迷失自我 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 20:08

    This isn't working anymore with XCode 7, I would suggest to use the new HockeyApp workaround https://github.com/bitstadium/HockeySDK-iOS/blob/6b727733a5a93847b4a7ff8a734692dbe4e3a979/Classes/BITHockeyHelper.m Here is a simplified version:

    + (BOOL)isAppStoreBuild
    {
    #ifdef DEBUG
        return NO;
    #else
        return ([UIApplication isTestFlightBuild] == NO);
    #endif
    }
    
    + (BOOL)isTestFlightBuild
    {
    #ifdef DEBUG
        return NO;
    #else
        NSURL *appStoreReceiptURL = NSBundle.mainBundle.appStoreReceiptURL;
        NSString *appStoreReceiptLastComponent = appStoreReceiptURL.lastPathComponent;
        BOOL isSandboxReceipt = [appStoreReceiptLastComponent isEqualToString:@"sandboxReceipt"];
    
        return isSandboxReceipt;
    #endif
    }
    

提交回复
热议问题