Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Merge pull request #15 from noa--/pullreq2
Browse files Browse the repository at this point in the history
Fix bug where items sometimes aren't deleted on Mac OS
  • Loading branch information
soffes committed Jan 27, 2013
2 parents e3736a3 + f254692 commit 7e767b4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions SSKeychain.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,18 @@ + (BOOL)deletePasswordForService:(NSString *)service account:(NSString *)account
OSStatus status = SSKeychainErrorBadArguments;
if (service && account) {
NSMutableDictionary *query = [self _queryForService:service account:account];
CFTypeRef result;
#if __has_feature(objc_arc)
status = SecItemDelete((__bridge CFDictionaryRef)query);
[query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnRef];
status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
#else
status = SecItemDelete((CFDictionaryRef)query);
[query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnRef];
status = SecItemCopyMatching((CFDictionaryRef)query, &result);
#endif
if (errSecSuccess == status) {
status = SecKeychainItemDelete((SecKeychainItemRef) result);
CFRelease(result);
}
}
if (status != noErr && error != NULL) {
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
Expand Down

0 comments on commit 7e767b4

Please sign in to comment.