Locksmith icon indicating copy to clipboard operation
Locksmith copied to clipboard

Crashing on Swift 3

Open johnpaulmanoza opened this issue 8 years ago • 11 comments

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.

screen shot 2016-10-26 at 2 07 16 pm

Locksmith 3.0.0 Xcode 8.0

johnpaulmanoza avatar Oct 26 '16 06:10 johnpaulmanoza

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 /.

ibeleliev avatar Nov 18 '16 10:11 ibeleliev

@johnpaulmanoza were you able to resolve this problem? I'm having a similar issue as well...

rlam3 avatar Nov 23 '16 01:11 rlam3

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 😄

johnnyoin avatar Nov 25 '16 15:11 johnnyoin

Any progress on this issue? I'm having the same problem :(

Micke5 avatar Mar 02 '17 14:03 Micke5

@johnnyoin Were you able to resolve this issue?

rlam3 avatar Mar 02 '17 17:03 rlam3

@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.

johnnyoin avatar Mar 03 '17 08:03 johnnyoin

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 avatar Mar 15 '17 18:03 iwasrobbed

@iwasrobbed are we assuming that the throw is only used for development and not for production?

rlam3 avatar Mar 19 '17 14:03 rlam3

@rlam3 no, there may be keychain errors at any time. Your app should handle failure cases gracefully. Using try! is not graceful.

getaaron avatar Mar 19 '17 15:03 getaaron

@getaaron Could you please kindly provide an example of a more graceful approach? Thanks!

rlam3 avatar Mar 19 '17 21:03 rlam3

@rlam3 Look at the do catch section: https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ErrorHandling.html

iwasrobbed avatar Mar 20 '17 15:03 iwasrobbed

@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?

getaaron avatar Mar 21 '17 16:03 getaaron