Skip to content

Commit

Permalink
add alert for errSecItemNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwarven committed Nov 16, 2017
1 parent 7b274e2 commit 7131bda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Classes/ApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ - (void)connect {

// Create identity.
result = SecIdentityCreateWithCertificate(_keychainRef, _certificateRef, &_identityRef);// NSLog(@"SecIdentityCreateWithCertificate(): %d", result);

if (errSecItemNotFound == result) {
NSLog (@"SecIdentityCreateWithCertificate errSecItemNotFound");
NSAlert * alert = [NSAlert alertWithMessageText:@"Certificates error" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Verify that the local keychain has the corresponding certificates and private keys on your Mac."];
[alert beginSheetModalForWindow:[[NSApplication sharedApplication] keyWindow] completionHandler:NULL];
return;
}

// Set client certificate.
CFArrayRef certificates = CFArrayCreate(NULL, (const void **)&_identityRef, 1, NULL);
Expand Down

0 comments on commit 7131bda

Please sign in to comment.