Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

iphone session management

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 store session information in an iPhone app like any other web application? Is there any other technique for that? thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...