Skip to content

Commit 674731d

Browse files
author
Keith Smith
committed
macOS Sierra /usr/bin/security appends a junk line on the entitlements xml/plist file that breaks signing.
1 parent df764ae commit 674731d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

iReSign/iReSign/iReSignAppDelegate.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,16 @@ - (void)checkEntitlementsFix:(NSTimer *)timer {
411411

412412
- (void)doEntitlementsEdit
413413
{
414+
//macOS 10.12 bug: /usr/bin/security appends a junk line at the top of the XML file.
415+
if ([entitlementsResult containsString:@"SecPolicySetValue"])
416+
{
417+
NSRange newlineRange = [entitlementsResult rangeOfString:@"\n"];
418+
if(newlineRange.location != NSNotFound) {
419+
entitlementsResult = [entitlementsResult substringFromIndex:newlineRange.location];
420+
}
421+
}
422+
//end macOS 10.12 bug fix.
423+
414424
NSDictionary* entitlements = entitlementsResult.propertyList;
415425
entitlements = entitlements[@"Entitlements"];
416426
NSString* filePath = [workingPath stringByAppendingPathComponent:@"entitlements.plist"];

0 commit comments

Comments
 (0)