iOS上的PhoneGap会话(Cookie) [英] PhoneGap session (cookies) on iOS

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

问题描述

在服务器上,我们有一组JSON API。

On server we have a set of JSON APIs.

有一种登录方法,用于验证用户并创建用户会话。对API上其他方法的后续调用假定用户已通过身份验证。

There's a login method that authenticates the user and creates user session. Subsequent calls to other methods on the API assume that the user is authenticated.

在客户端,我们有PhoneGap和jQuery mobile。
我们使用ajax调用与服务器通信。

On client side we have PhoneGap and jQuery mobile. We use ajax calls to communicate with server.

在Android会话管理可以,但是在登录后的iOS上,似乎会话cookie不会被发回

On Android session management is OK, but on iOS after login it seems like the session cookie is not sent back on next call (or is not accepted at all) and the calls fail on server as if the user is not authenticated.

当在同一台设备上通过Safari测试时,一切都正常工作罚款。

When tested from Safari on the same device everything works fine.

相同的行为是在iPad 2 iOS 5.0和iPhone 4S与iOS 5.1。

Same behaviour is on iPad 2 with iOS 5.0 and iPhone 4S with iOS 5.1.

任何想法?

推荐答案

问题出现在UserAgent字符串中。 ASP.NET需要配置为接受Mozilla / iOS。请参见使用iPhone UIWebView时的Asp.Net表单身份验证问题

the problem was with UserAgent string. ASP.NET needs to be configured to accept Mozilla/iOS. See Problem with Asp.Net Forms Authentication when using iPhone UIWebView

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

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