Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kevinlawler/7668318 to your computer and use it in GitHub Desktop.
Save kevinlawler/7668318 to your computer and use it in GitHub Desktop.
static BOOL PSPDFIsDevelopmentBuild(void) {
#if TARGET_IPHONE_SIMULATOR
return YES;
#else
@autoreleasepool {
// There is no provisioning profile in AppStore Apps.
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]];
if (data) {
const char *bytes = [data bytes];
NSMutableString *profile = [NSMutableString new];
for (NSUInteger i = 0; i < data.length; i++) {
[profile appendFormat:@"%c", bytes[i]];
}
// Look for debug value, if detected we're a development build.
NSString *cleared = [[profile componentsSeparatedByCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet] componentsJoinedByString:@""];
return [cleared rangeOfString:@"<key>get-task-allow</key><true/>"].length > 0;
}
}
return NO;
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment