Skip to content

Instantly share code, notes, and snippets.

@nickdowell
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickdowell/759b51097e2f2e72daed to your computer and use it in GitHub Desktop.
Save nickdowell/759b51097e2f2e72daed to your computer and use it in GitHub Desktop.
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]];
const char *ptr = [data bytes], *start = NULL, *end = NULL;
for (size_t i = 0; i < [data length] - 8; i++) {
if (memcmp(ptr + i, "<plist", 6) == 0) {
start = ptr + i;
}
if (memcmp(ptr + i, "</plist>", 8) == 0) {
end = ptr + i + 8;
}
}
NSData *plistData = [data subdataWithRange:NSMakeRange(start - ptr, end - start)];
NSDictionary *plist = [NSPropertyListSerialization propertyListWithData:plistData options:0 format:NULL error:NULL];
NSLog(@"Entitlements = %@", [plist objectForKey:@"Entitlements"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment