Locksmith
Locksmith copied to clipboard
Crashing on Swift 3
Hi Im having a trouble loading the keychain data. App crash when loadDataForUserAccount is called. xcode stops here Locksmith.swift (Line 84). Thank you for any help.
Locksmith 3.0.0 Xcode 8.0
This error occurs to me too. It is happening when i use Locksmith.loadDataForUserAccount for account that was previously deleted by using Locksmith.deleteDataForUserAccount. So it tries to read from something that doesn't exist in the keychain and returns error with statusCode -25300 / Locksmith.LocksmithError notFound /.
@johnpaulmanoza were you able to resolve this problem? I'm having a similar issue as well...
I have this issue as well but the app doesn't crash. Locksmith complains about a duplicate but still does the job. I'm not saying I don't want it to be fixed though 😄
Any progress on this issue? I'm having the same problem :(
@johnnyoin Were you able to resolve this issue?
@rlam3 I didn't have to since the app doesn't crash in my case. It stops on the Swift Error breakpoint but still works properly.
The whole point of throw
is for devs to use try
and catch those errors so it won't crash. If you're doing try!
instead of try
then you're causing the crash, not Locksmith.
@iwasrobbed are we assuming that the throw is only used for development and not for production?
@rlam3 no, there may be keychain errors at any time. Your app should handle failure cases gracefully. Using try!
is not graceful.
@getaaron Could you please kindly provide an example of a more graceful approach? Thanks!
@rlam3 Look at the do
catch
section: https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ErrorHandling.html
@rlam3 I would be happy to provide a code sample. Can you post a full stack trace and the method you're calling so I can see how you're getting this to occur?