Locksmith icon indicating copy to clipboard operation
Locksmith copied to clipboard

deleteDataForUserAccount not failing, but not deleting data

Open mhuusko5 opened this issue 8 years ago • 7 comments

I'm updateData(forUserAccount:inService:) successfully , loadDataForUserAccount successfully, deleteDataForUserAccount seemingly successfully (doesnt catch/fail), but then loadDataForUserAccount still works/loads the data that should have been deleted.

mhuusko5 avatar Apr 12 '16 14:04 mhuusko5

Hmm strange. Which version of Locksmith and iOS? Also if you can reliably reproduce a sample project would be super helpful. Thanks!

On 13 Apr 2016, at 12:27 AM, Mathew Huusko V [email protected] wrote:

I'm updateData(forUserAccount:inService:) successfully , loadDataForUserAccount successfully, deleteDataForUserAccount seemingly successfully (doesnt catch/fail), but then loadDataForUserAccount still works/loads the data that should have been deleted.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

matthewpalmer avatar Apr 12 '16 19:04 matthewpalmer

I have same problem. Locksmith (2.0.8), iOS 9.2 One weird thing. It seems like deletion works great until I terminate app. After termination and restart "deleted" data is available again through Locksmith.

JanBorowskiES avatar Apr 15 '16 07:04 JanBorowskiES

Hi @matthewpalmer

Seems that I just run into the same problem.

In my case I am unable to read or write to the Keychain after I presentViewController UIImagePickerController. Strange... Locksmith.loadDataForUserAccount() returns nil, deleteDataForUserAccount() and saveData() exits without throwing any error. After restarting the app I can read from the Keychain, also data that supposed to be deleted still exists.

After some debugging and googling I think it may be related to a mysterious bug in the Keychain which manifests itself as the OSStatus -34018. https://forums.developer.apple.com/thread/4743 In the Locksmith this code is not handled and falls into if statement: https://github.com/matthewpalmer/Locksmith/blob/6b32c7ec68324f33f2b8fb0765213c74a6f86dd5/Source/Locksmith.swift#L87, probably why writing and reading exits without any error.

I am able to reproduce it but not in every iteration and only if the app is connected with Xcode (debug mode, iOS 9.2.1).

@JanBorowskiES @mhuusko5 Maybe setting breakpoints in the method linked above will help you verify if it is the same problem (not handled error code and/or bug in the iOS Keychain).

piotr-dudek avatar Apr 29 '16 14:04 piotr-dudek

I'm having the same issue. Any one come up with a solution?

alaxicsmith avatar May 07 '16 18:05 alaxicsmith

Same issue on this now and it's December 15th. How did this get solved?

bdrelling avatar Dec 16 '16 22:12 bdrelling

Same issue! Still available the data, after using deleteData method with Locksmith...

gaborcsontos avatar Jul 02 '17 13:07 gaborcsontos

Same here. Would like to know if that's a human error or not. Running v4.0.0 with iOS 11.2.2 iPhone 6.

Update: I've been testing this with synchronously and asynchronously dispatch queue and found that if you put this deleteDataForUserAccount(userAccount:) inside an async DispatchQueue, it might cause the problem.

My solution in the mean time is just to run the delete method synchronously.

christwsy-zz avatar Jan 23 '18 08:01 christwsy-zz