James Wilks
James Wilks

Reputation: 740

Different NSUserDefaults on the Same System

I am a beginning iOS developer and have encountered a situation I'm not sure how to handle. I have created a working system of saving and retrieving the user preferences in my application. I don't have many preferences which is why I have chosen not to use sqlite3 and coredata. I want to obtain different preferences based on which user is signed in. I understand that NSUserDefaults doesn't save to a single user but a single device so I was looking for a clever work around for this problem. My only idea was to append the username to the key but I thought it would be dumb to create that many different keys. If this is of any concern, I'm using Parse as my cloud service to handle log in and etcetera. Thanks!

Upvotes: 0

Views: 60

Answers (1)

Catfish_Man
Catfish_Man

Reputation: 41801

You could use the -initWithSuiteName: method on NSUserDefaults to create a new preferences suite for each user.

Upvotes: 1

Related Questions