If you setup a dictionary to delete and rewrite an item in the KC, adding the
kSecAttrIsInvisible
attribute, then the delete will FAIL if the previous write was done without the invisible attribute.
Right. This is expected behaviour. Remember that the dictionary you pass to
SecItemDelete
is a
query dictionary: It’s used to match the items to delete. If you supply a specific attribute value, the query will on match items with that value, meaning it’ll fail to match:
My preferred approach for dealing with the keychain is to carefully limit the contents of my query dictionary to those attributes that participate in uniqueness. There’s a list of such attributes in the docs for
errSecDuplicateItem
.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"