我想检查用户是否在iOS 5.0以下运行应用程序,并在应用程序中显示一个标签。

我如何以编程方式检测哪个iOS正在用户的设备上运行?

谢谢!

在NSString或nsmutablestring中不可能有多种颜色。我听说过一点NSAttributedString,它是在iPad SDK 3.2(或大约3.2)中引入的,并且在iPhone SDK 4.0 beta版中可用。

我想要一根有三种颜色的绳子。

我不使用3个独立的NSString的原因,是因为三个NSAttributedString子字符串的长度经常改变,所以我宁愿,不使用任何计算重新定位3个独立的NSString对象。

如果使用NSAttributedString是可能的,我怎么做以下-(如果不可能使用NSAttributedString,你会怎么做):

编辑: 记住,@"first", @"second"和@"third"随时会被其他字符串替换。所以使用硬编码的NSRange值是行不通的。

目标: 允许用户通过Facebook认证进入iOS应用程序,这需要访问我正在运行的受保护的web服务。

假设: 对于那些选择不使用Facebook登录的用户,有一个本地认证(和注册)系统。

细节:

假设我们希望为用户提供一种选择,让用户无需为我们的系统创建单独的帐户/凭据就可以登录Facebook。 因为我们支持自己的本地身份验证机制(用户名和密码),所以我们有自己的用户id,并发出一个身份验证令牌,该令牌在初始凭证验证之后用于后续交互。

我很惊讶Facebook在他们的开发者文档中没有这方面的最佳实践。所有现有的文档都假设你正在将facebook认证构建到一个网站中,或者是一个不需要认证服务的独立移动应用程序。

以下是我对这将如何设计的最初想法,但希望验证它是否正确。

Client pops the Facebook iOS Login UI User signs in with Facebook credentials and gets access token iOS App passes access token to our server Our server talks to FB graph API using access token to (a) validate the token and (b) get the FB user ID for that access token. e.g. Our server would call https://graph.facebook.com/me/?access_token=XYZ which would return profile info in a JSON object Assuming it's valid, our server extracts the User ID from the JSON object and checks whether the user already has an account. If so, we issue our own auth ticket to client to use for that session. If user doesn't have an account, we create a new one with the Facebook User ID, assign our own unique UserID and issue our auth ticket. Client then passes auth ticket back on subsequent interactions that need authentication.

这对我来说似乎是正确的方法,但不确定我是否错过了一些疯狂的基本内容,走上了错误的(复杂的)道路。