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

Reason for setObject to be NSData? #39

Closed
bjarkehs opened this issue Sep 7, 2015 · 3 comments
Closed

Reason for setObject to be NSData? #39

bjarkehs opened this issue Sep 7, 2015 · 3 comments
Labels

Comments

@bjarkehs
Copy link

bjarkehs commented Sep 7, 2015

Is there a specific reason why setObject only takes NSData?

@dfed dfed added the question label Sep 7, 2015
@dfed
Copy link
Collaborator

dfed commented Sep 7, 2015

NSData is how the keychain stores data (see Apple's documentation of kSecValueData). Moreover, conforming toNSCoding is pretty much a requirement for storing any object outside of CoreData.

We've written setString:forKey: and stringForKey: helper methods that make it easy to store passwords and other string values. Out of curiosity, what kind of values are you storing in the keychain?

@bjarkehs
Copy link
Author

bjarkehs commented Sep 7, 2015

That makes perfect sense. Thanks for taking your time to explain it. I'm storing a string and also an array of strings. So it's not really a problem to make it into NSData

@dfed
Copy link
Collaborator

dfed commented Sep 7, 2015

Awesome. Closing this out.

@dfed dfed closed this as completed Sep 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants