New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on Save #1
Comments
Hmm. I haven't been able to reproduce this on my end with a fresh clone. It's strange that that line would cause a crash. Could you please try replacing that section of code (up until the return) with if result != nil {
if let data: NSData = result?.takeRetainedValue() as? NSData {
// Convert the retrieved data to a dictionary
resultsDictionary = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? NSDictionary
}
} and let me know if the error still happens. Also, what version of Xcode and iOS is this running on? Thanks so much for your help :) |
Hey @matthewpalmer I added that nil check but it didn't do anything. The
I'm using Xcode 6.1 and the simulator is on iOS 8.1. Thanks!! |
Does the app completely crash? (i.e. With EXC_BAD_ACCESS as you described before) The "the item already exists" error means that something has been saved to the keychain using that key before. If you press "load" (in the demo app) it should print out the value of what was saved to the keychain in the log of Xcode. Is there any output when you press 'load', or does it just crash? Cheers
|
I got the exact same error. Have tried to add the nil-check aswell. It's crashing on the same line. Both on simulator and device. (iOS8.1) |
Just pushed an update that might have fixed this. Is the crash still happening with da755c7 (i.e. the latest version)? Thanks so much for your help :) |
Hey @matthewpalmer, I pulled down the latest and greatest and then tried again. To be sure nothing was carrying over, I reset my simulator. Then I built and ran the app, pressed "save" and got this error:
When I stopped, ran the app again and hit "save" a second time, I got this error:
I stopped the app, ran it once again and hit "load" and got this:
So, that worked! Then I tried to press "delete" and that failed with:
I have not upgraded to Xcode 6.1.1, just FYI. I hope that helps and I appreciate your help on this!! :) |
I can't reproduce this, even with a fresh clone and a reset simulator. Could you possibly please track down which line or function it's trying to unwrap the optional in/the app crashes? |
Thanks for trying to help me with this - I've actually been having a lot of trouble with the keychain, which is whey I was interested in this project. I keep writing code that I think should work and then I'll get into this weird situation. I'll ask the keychain for a value and it'll say that it doesn't exist. Then I'll try to write it and it'll say that it can't because it's a duplicate. WTF?? To answer your question, the line that's blowing up is So, in summary, I hate working with the keychain and its unexpected behavior makes me not want to use it. /rant |
That sucks that you've been having so much trouble. I totally agree, the keychain is tough to deal with. And it crashes with
on that I've just pushed an update that might solve the issue, or at least give us some more information. Could you please run through the save, load, and delete cycle then paste the output here. Thanks so much :) |
I was having this exact issue before the update. Issue may be resolved now. Source: It works on my machine :) |
Hey @matthewpalmer, that update definitely helped - I'm only seeing failures when I expect them now!!!! While testing this, I found it helpful to save timestamps instead of just a string, so I opened #3 with that if you're interested. Anyway, here's the results of playing around after a simulator reset... Pressing Save:
Pressing Load:
Pressing Delete:
So, all three worked great - then I wanted to see what tapping multiple times would do. Multiple Saves:
Multiple Deletes:
My only remaining crash is when I tap 'Delete', then 'Load':
Fails in Locksmith.swift, line 46:
That same thread error I originally reported. I don't get it - I've tried unwrapping that damn if type == .Read && status == errSecSuccess {
if let data = result!.takeUnretainedValue() as? NSData {
resultsDictionary = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? NSDictionary
}
} Here we just rely on the status being successful, which seems safer. And this worked for me - I can blow away the token and try loading without a crash. It won't find anything, but it shouldn't anyway. So, I'm going to close this one and thank you for hanging in there and helping me - I really appreciate it!! :) Jon |
I'll implement this fix now. Thanks for all your help. |
I cloned down the repo, built the app and then pressed save - crashed and burned with:
I doubt that's very helpful, but I'm not sure what else to do to troubleshoot this. I did stop the app and run it again, then I got another error:
In both cases, we're stopping on this line:
That's in Locksmith.swift line 40.
The text was updated successfully, but these errors were encountered: