diff options
author | davidair <davidair@users.noreply.github.com> | 2017-10-26 09:42:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-26 09:42:10 -0400 |
commit | 73c7798f8506460663f4b2a7e3b0085319743b84 (patch) | |
tree | 502e16e5e1adec782553b89ed488f991506c772c /Firebase/Core/third_party/FIRAppEnvironmentUtil.m | |
parent | 390d600b53432f33558e63ef05621ec57f03f07f (diff) |
Fixing AppStore detection (#410)
Fixing a bug where isFromAppStore would return YES for TestFlight apps
Diffstat (limited to 'Firebase/Core/third_party/FIRAppEnvironmentUtil.m')
-rw-r--r-- | Firebase/Core/third_party/FIRAppEnvironmentUtil.m | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m index 64c85d9..3a08cfa 100644 --- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m +++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m @@ -130,6 +130,14 @@ static BOOL isAppEncrypted() { if ([FIRAppEnvironmentUtil isSimulator]) { return NO; } + + // If an app contain the sandboxReceipt file, it means its coming from TestFlight + // This must be checked before the SCInfo Folder check below since TestFlight apps may + // also have an SCInfo folder. + if ([FIRAppEnvironmentUtil isAppStoreReceiptSandbox]) { + return NO; + } + if ([FIRAppEnvironmentUtil hasSCInfoFolder]) { // When iTunes downloads a .ipa, it also gets a customized .sinf file which is added to the // main SC_Info directory. @@ -138,11 +146,9 @@ static BOOL isAppEncrypted() { // For iOS >= 8.0, iTunesMetadata.plist is moved outside of the sandbox. Any attempt to read // the iTunesMetadata.plist outside of the sandbox will be rejected by Apple. - // If the app does not contain the sandboxReceipt file which means it is a TestFlight beta, and - // it does not contain the embedded.mobileprovision which is stripped out by Apple when the - // app is submitted to store, then it is highly likely that it is from Apple Store. - return isEncrypted && ![FIRAppEnvironmentUtil isAppStoreReceiptSandbox] && - ![FIRAppEnvironmentUtil hasEmbeddedMobileProvision]; + // If the app does not contain the embedded.mobileprovision which is stripped out by Apple when + // the app is submitted to store, then it is highly likely that it is from Apple Store. + return isEncrypted && ![FIRAppEnvironmentUtil hasEmbeddedMobileProvision]; } + (BOOL)isAppStoreReceiptSandbox { |