Skip to content
This repository was archived by the owner on Aug 24, 2019. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions SSKeychain/SSKeychainQuery.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ - (BOOL)deleteItem:(NSError *__autoreleasing *)error {
#if TARGET_OS_IPHONE
status = SecItemDelete((__bridge CFDictionaryRef)query);
#else
// On Mac OS, SecItemDelete will not delete a key created in a different
// app, nor in a different version of the same app.
//
// To replicate the issue, save a password, change to the code and
// rebuild the app, and then attempt to delete that password.
//
// This was true in OS X 10.6 and probably later versions as well.
//
// Work around it by using SecItemCopyMatching and SecKeychainItemDelete.
CFTypeRef result = NULL;
[query setObject:@YES forKey:(__bridge id)kSecReturnRef];
status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
Expand Down