Created
July 9, 2015 00:18
-
-
Save jcayzac/c8c1435191522440c561 to your computer and use it in GitHub Desktop.
Fun with embedded.mobileprovision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSData *provisioningProfile = nil; | |
| NSData *raw = [NSData dataWithContentsOfURL:[NSBundle.mainBundle URLForResource:@"embedded" withExtension:@"mobileprovision"]]; | |
| char *start = memmem(raw.bytes, | |
| raw.length, | |
| "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0", | |
| 47); | |
| if (start) { | |
| char *end = memmem(start, | |
| (uintptr_t)start - raw.length, | |
| "</plist>", | |
| 8); | |
| if (end) { | |
| provisioningProfile = [NSData dataWithBytes:start length:8 + end - start]; | |
| } | |
| } | |
| if (provisioningProfile) { | |
| NSDictionary* plist = [NSPropertyListSerialization propertyListWithData:provisioningProfile | |
| options:NSPropertyListImmutable | |
| format:0 | |
| error:0]; | |
| NSLog(@"\n\n\nTeam name: %@", plist[@"TeamName"]); | |
| if ([plist[@"ProvisionsAllDevices"] boolValue]) { | |
| NSLog(@"Enterprise"); | |
| } else if ([plist[@"ProvisionedDevices"] count] > 0) { | |
| if ([plist[@"Entitlements"][@"get-task-allow"] boolValue]) { | |
| NSLog(@"Development"); | |
| } else { | |
| NSLog(@"Ad Hoc"); | |
| } | |
| } else { | |
| NSLog(@"App Store"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice! it's so cool! XD