-
Notifications
You must be signed in to change notification settings - Fork 11
/
CertUtils.m
24 lines (18 loc) · 907 Bytes
/
CertUtils.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#import "CertUtils.h"
@implementation CertUtils
+ (NSDictionary *)provisioningProfileAtPath:(NSString *)path {
NSError *err;
NSString *stringContent = [NSString stringWithContentsOfFile:path encoding:NSASCIIStringEncoding error:&err];
stringContent = [stringContent componentsSeparatedByString:@"<plist version=\"1.0\">"][1];
stringContent = [NSString stringWithFormat:@"%@%@", @"<plist version=\"1.0\">", stringContent];
stringContent = [stringContent componentsSeparatedByString:@"</plist>"][0];
stringContent = [NSString stringWithFormat:@"%@%@", stringContent, @"</plist>"];
NSData *stringData = [stringContent dataUsingEncoding:NSASCIIStringEncoding];
NSError *error;
NSPropertyListFormat format;
id plist;
plist = [NSPropertyListSerialization propertyListWithData:stringData options:/*unused*/0 format:&format error:&error];
if (!plist)NSLog(@"%@", error);
return plist;
}
@end