I’m trying to create a program that can handle multiple users, each of which should have access to independent and private data. What is the best way to make it such that specific users can only see data that they’ve created or saved?
For instance, if I wanted to have an array of
myData = [NSMutableArray arrayWithObjects: @"A", @"B", @"C", @"D", nil];
for each user, do I need to use core data to save the array, and somehow tag that array to that specific user?
Without inconveniencing the user(s) you can’t do it securely.
Any data stored on the device in your application’s folders could be obtained by a user capable of accessing the phone. (iTunes backups, etc). So storing data in folders based on username/user-id or storing things in a sqllite database (core data) partitioned by userid isn’t going to help anything.
You could attempt to encrypt the data and keep user password hashes in the keychain – but you’re really going to start jumping through hoops. Decrypting any serious amount of data will definitely make your app slower (if that matters to you).
The fact of the matter is, iOS just doesn’t support multiple users at the moment – and that’s what you really need – OS-level multi-user support.