关于iPad应用程序的sskeychain和基本身份验证的教程? [英] Tutorial on sskeychain and basic auth for iPad apps?

查看:132
本文介绍了关于iPad应用程序的sskeychain和基本身份验证的教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在哪里可以找到一个很好的详细教程,使用 sskeychain 来存储和检索用户名和密码,以及在UIWebView中进行基本身份验证?其次,就基于Web的应用程序存储和使用身份验证所需的方法而言,我是否在正确的轨道上? (见下面的解释。)

Where can I find a good detailed tutorial using sskeychain to store and retrieve usernames and passwords and to do basic authentication in a UIWebView? Secondarily, am I on the right track as far as the methods needed to store and use authentication for a web based application? (See explanation below.)

我发现了一些使用不同方法的教程:

I found a couple tutorials using different methods:

  • Interacting with keychain directly
  • Handmade keychain wrapper (sic)
  • SFHFKeychainUtils

根据以下其他SO问题的建议,建议使用sskeychain以便更容易地使用钥匙串来存储身份验证参数。

According to recommendations from other SO questions below, sskeychain is recommended for an easier use of the keychain to store authentication parameters.

  • Cocoa interface to MacOS X Keychain
  • https://stackoverflow.com/questions/8381072/save-username-and-password-for-url-like-gmail-com-iphone

我的计划是按照建议在钥匙串中在设备上本地存储用户名和密码,并使用基本身份验证通过UIWebView连接到我的PHP代码。是否有经验丰富的iOS开发人员推荐的关于用户身份验证主题的xcode / Obj-C新手的一步一步的好教程?

My plan is to store a username and password locally on the device in the keychain as recommended and connect over a UIWebView using basic auth to my PHP code. Is there a good step by step tutorial for xcode/Obj-C newbies on the topic of user authentication that would be recommended by experienced iOS developers?

Apple文档似乎少了比有帮助。它既可以是简单的销售术语,也可以是方法和参数的头部描述,但没有很多有用的示例。

The Apple documentation seems less than helpful. It's either pages with simple sales jargon or just head imploding descriptions of methods and parameters without many helpful examples.

更新:

我最终只使用NSUserDefaults在本地存储用户名和密码,而AFNetworking库则进行身份验证。如果这些是不明智的,我会欢迎一个答案,为更好的方法提供指导。

I ended up just using NSUserDefaults to store the username and password locally and the AFNetworking library to do the authentication. If these are unwise I'd welcome an answer that supplies guidance on a better method.

推荐答案

如果你想做基本的身份验证你可能最好使用像AFNetworking这样的网络服务。他们所有你创建一个webclient,传递用户名/密码组合,他们负责其余的。

If you want to do basic auth, you might be better off using a networking service like AFNetworking. They all you to create a webclient, pass in a username/password combination and they take care of the rest.

此链接显示您需要调用的确切方法调用:
http:// engineering。 gowalla.com/AFNetworking/Classes/AFHTTPClient.html#//api/name/setAuthorizationHeaderWithUsername:password

This link show you the exact method call you need to invoke: http://engineering.gowalla.com/AFNetworking/Classes/AFHTTPClient.html#//api/name/setAuthorizationHeaderWithUsername:password:

还有一个庞大的社区和一堆在所有类型的iOS项目中使用AFNetworking的开发人员的例子。

There is also a large community and a bunch of examples of developers using AFNetworking in all types of iOS project.

这篇关于关于iPad应用程序的sskeychain和基本身份验证的教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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