iphone会话管理 [英] iphone session management

查看:91
本文介绍了iphone会话管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何管理iPhone应用中的用户会话?我在应用的第一页上收到了用户的用户名和密码。用户可以随时注销。如何将会话信息存储在iPhone应用程序中,就像任何其他Web应用程序一样?还有其他技术吗?
谢谢你。

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.

推荐答案

你可以从 NSUserDefaults 打电话你应用中的任何地方。这通常是存储状态信息的地方。

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.

我会提醒您,iPhone应用程序的设计模式与Web应用程序不同。除非您实现基于Web的界面,否则您不应该考虑页面和会话。

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.

这篇关于iphone会话管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆