iphone session management

前端 未结 2 2076
北海茫月
北海茫月 2020-12-12 01:17

How can I manage user sessions in an iPhone app? I get a username and password from the user on the first page of my app. The user may log out whenever he wants. How can I s

2条回答
  •  一个人的身影
    2020-12-12 01:57

    You can call NSUserDefaults from anywhere in your app. This is usually where state information is stored.

    If you envision that you might have to store information for a large number of users, you should create a custom database and only rely on . The easiest way to do that is to use Core Data. You can park the managed object context in the application delegate and then access that from anywhere by calling the app delegate.

    I would caution you that an iPhone app has a different design pattern than a web app. You shouldn't be thinking in terms of pages and sessions unless you are implementing a web based interface.

提交回复
热议问题