diff options
Diffstat (limited to 'example/common/FXKeychain.m')
-rwxr-xr-x | example/common/FXKeychain.m | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/example/common/FXKeychain.m b/example/common/FXKeychain.m index f4cb4388..f0ba73c0 100755 --- a/example/common/FXKeychain.m +++ b/example/common/FXKeychain.m @@ -105,7 +105,13 @@ NSAssert(!object || (object && data), @"FXKeychain failed to encode object for key '%@', error: %@", key, error); //delete existing data - OSStatus status = SecItemDelete((__bridge CFDictionaryRef)query); + CFTypeRef result; + [query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnRef]; + OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);//SecItemDelete((__bridge CFDictionaryRef)query); + if (status == errSecSuccess) { + status = SecKeychainItemDelete((SecKeychainItemRef) result); + CFRelease(result); + } //write data if (data) |