Skip to content

Commit

Permalink
fix: Correctly attribute enterprise builds (#2235)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrenskers authored Sep 29, 2022
1 parent 7c867f1 commit 5ecf9f6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 15 additions & 14 deletions Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_System.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
{
Expand All @@ -477,6 +475,9 @@
if (isDebugBuild()) {
return "debug";
}
if (hasEmbeddedMobileProvision()) {
return "enterprise";
}
if (isTestBuild()) {
return "test";
}
Expand Down

0 comments on commit 5ecf9f6

Please sign in to comment.