Question

I found this question:

What are the best practices for managing multiple users on an iPad app?

But it is a couple of years old, is answered by the asker and he doesn't seem to be too sure of himself, so I thought I'd go ahead and ask this:

Say I'm making an app for tutors, that they use to track data of their students. I want the tutor to be able to "login" with the name/ID of a particular student, so only that student's data is shown, and any new data is added to that student's data. This is throughout quite a wide ranging app.

I put "login" in inverted commas, because it is not really a login in the usual sense, as the app is only used by the one tutor.

The "login" doesn't need security, and I won't even have passwords.

I just want to know what the accepted way to tackle this is. Core Data? Keychain? User defaults? Something else?

I also need to be able to store what student is currently "logged in", and use this info throughout the app. I'm thinking of using the singleton pattern. Would that be the normal way to go?

I'm a relatively newbie, having recently completed the Stanford beginners course. I'm keen to make my app in a way that adheres to iOS standards.

Thanks in advance.

Was it helpful?

Solution

Use any database, such as SQL or CoreData. Then make sure each entry in the database has an username property so you can later filter by it. To store the current user, I recommend NSUserDefaults. See the following links:

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html

https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/CoreData/cdProgrammingGuide.html

http://www.raywenderlich.com/913/sqlite-tutorial-for-ios-making-our-app

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top