Skip to content
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

overwriting keys #10

Open
core-code opened this issue Jan 23, 2013 · 9 comments
Open

overwriting keys #10

core-code opened this issue Jan 23, 2013 · 9 comments

Comments

@core-code
Copy link

this fails for me on the mac on line 3 that tries to set the new key @"1". only the first setting for a key ever succeeds

assert([Lockbox setString:@"1" forKey:@"test"]);
assert([[Lockbox stringForKey:@"test"] isEqualToString:@"1"]);
assert([Lockbox setString:@"2" forKey:@"test"]);
assert([[Lockbox stringForKey:@"test"] isEqualToString:@"2"]);
@core-code
Copy link
Author

...new key @"2"

@granoff
Copy link
Owner

granoff commented Jan 26, 2013

Thanks for reporting this. Unfortunately, I cannot reproduce this, and my unit tests (newly added to this project) confirm that the class is working as expected.

It'd be interesting if you wouldn't mind grabbing the latest code from my master branch and running the unit tests on your machine. (Open the LockBox project and go to Product -> Test). Do they all pass?

@core-code
Copy link
Author

did you test on Mac OS X? i couldn't even get it to compile on Mac OS X without some changes...

yes i had the latest code, obtaining old code isn't even easy with github ;)

@granoff
Copy link
Owner

granoff commented Jan 26, 2013

The tests (which I just pushed to this repo) run on Mac OS X.

@core-code
Copy link
Author

thanks i'll have a look tomorrow.

@core-code
Copy link
Author

i couldn't find a way to run the tests on Mac OS X directly from the provided xcode project as it is iOS only and chaning it didn't really work. additionally the main Lockbox.m still didn't compile on Mac OS X without minor changes.

i've creates a new project "test", imported Lockbox master and still get the same behaviour.

https://dl.dropbox.com/u/7221986/lockbox.zip

just run test/test.xcodeproj and see it hanging in the assertion

@granoff
Copy link
Owner

granoff commented Jan 27, 2013

Hmm. Ok, it doesn't work under Cocoa, just Cocoa Touch.

I ran your code and stepped through it and saw the same issues you saw. The project provided with this repo is an iOS project. I think the issue is that the keychain under Mac OS works slightly differently than under iOS, which is unfortunate to be sure.

I don't have the time right now to figure this out for Cocoa; sorry. The issue has something to do with the dictionary provided to SecItemDelete() because it is returning a status indicating it cannot find the key in question to remove, before we set the new value. But I would be happy to accept a pull request that makes the class work for both Cocoa and Cocoa Touch. :-)

@core-code
Copy link
Author

no problem. i've switched to another keychain wrapper which works fine out-of-box, just wanted to let you know about the issues.

@granoff
Copy link
Owner

granoff commented Jan 27, 2013

I appreciate it; thanks. Truth be told, I am an iOS developer and I developed the class for an iOS project. I don't do Mac OS work, but I suppose I might someday. So I'll leave this issue open as a reminder that there's an issue for Cocoa use.

Repository owner deleted a comment from Soumya6Tiwari Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants