Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在创建一个 iphone 应用程序,该应用程序登录到我们的网站并检索表格,并在应用程序中显示内容。要查看表格,需要登录。该站点似乎正在使用基于表单的身份验证。网站的登录屏幕
那么如何传递登录 ID 并从 xcode 传递到站点并保留信息,以便用户只需要登录一次。
要记住登录凭据,最简单的方法是将它们放入 NSDictionary 并将其写入应用程序包,然后在需要时读取它。请记住让用户有机会稍后更改他们的登录凭据,并至少考虑加密数据。
至于基于表单的登录,要走的路是为登录表单的 URL 创建一个 NSURLRequest,如果它是基于 GET 的,只需像 url.somewhere/form?user=foo&pass=bar 一样,如果是基于 POST,更改创建的请求并在 POST 字段中包含所需的信息。