From 5ecf9f6f92ee2598fd21b95d1a3af356d9969c50 Mon Sep 17 00:00:00 2001 From: Kevin Renskers Date: Thu, 29 Sep 2022 10:31:25 +0200 Subject: [PATCH] fix: Correctly attribute enterprise builds (#2235) --- CHANGELOG.md | 4 +++ .../Monitors/SentryCrashMonitor_System.m | 29 ++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4427992ecec..6469cda1d2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ - Report start up crashes (#2220) - Add segment property to user (#2234) +### Fixes + +- Correctly attribute enterprise builds (#2235) + ## 7.26.0 ### Features diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_System.m b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_System.m index 3d43b1d79fc..d7953ab4eff 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_System.m +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_System.m @@ -368,26 +368,15 @@ /** The file path for the bundle’s App Store receipt. * - * @return App Store receipt for iOS 7+, nil otherwise. + * @return App Store receipt for iOS, nil otherwise. */ static NSString * getReceiptUrlPath() { - NSString *path = nil; #if SentryCrashCRASH_HOST_IOS - // For iOS 6 compatibility -# ifdef __IPHONE_11_0 - if (@available(iOS 7, *)) { -# else - if ([[UIDevice currentDevice].systemVersion compare:@"7" options:NSNumericSearch] - != NSOrderedAscending) { -# endif + return [NSBundle mainBundle].appStoreReceiptURL.path; #endif - path = [NSBundle mainBundle].appStoreReceiptURL.path; -#if SentryCrashCRASH_HOST_IOS - } -#endif - return path; + return nil; } /** Generate a 20 byte SHA1 hash that remains unique across a single device and @@ -468,6 +457,15 @@ return isAppStoreReceipt && receiptExists; } +/** + * Check if the app has an embdded.mobileprovision file in the bundle. + */ +static bool +hasEmbeddedMobileProvision() +{ + return [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"] != nil; +} + static const char * getBuildType() { @@ -477,6 +475,9 @@ if (isDebugBuild()) { return "debug"; } + if (hasEmbeddedMobileProvision()) { + return "enterprise"; + } if (isTestBuild()) { return "test"; }