iPhone 登录通知

发布于 2024-07-24 21:12:59 字数 139 浏览 3 评论 0原文

有一个与使用异步 NSURLConnection 的 iPhone 登录身份验证最佳实践相关的问题。

由于使用相同的委托登录服务器,人们如何区分身份验证请求返回的通知和后续数据请求收到的数据?

谢谢,

Sj

Had a question related to best practices in iPhone login authentication using asynchronous NSURLConnection.

Since the same delegate is used for logging into a server, how do folks differentiate notifications coming back for an authentication request, versus when you recieve data for subsequent data requests?

Thanks,

Sj

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生活了然无味 2024-07-31 21:12:59

如果您所说的身份验证是指 HTTP 身份验证,那么该身份验证不会作为数据返回给您。 它在 -connection:didReceiveAuthenticationChallenge: 中返回。 如果您正在谈论管理 HTTP 层之上的身份验证的更高级别协议,那么您的工作就是跟踪连接的当前状态。

请参阅使用NSURLConnection 了解有关 HTTP 身份验证的完整详细信息。

If by authentication, you mean HTTP authentication, then that is not handed back to you as data. It comes back in -connection:didReceiveAuthenticationChallenge:. If you're talking about a higher-level protocol that manages authentication above the HTTP layer, then it's your job to keep track of the current state of your connection.

See Using NSURLConnection for full details on HTTP Auth.

才能让你更想念 2024-07-31 21:12:59

使用的常见模式是为每种类型的请求创建一个不同的类,并使其管理自己的 NSURLConnection 生命周期。 然后它可以将事件发送回其委托。

另一种方法是记住您创建的所有 NSURLConnection 并将它们与委托回调的第一个参数进行比较。

The common pattern to use would be to create a different class for each type of request you have and make it manage the lifetime its own NSURLConnection. It can then send events back to its delegate.

The other method would be to remember all the NSURLConnections you've created and compare them against the first parameter of the delegate callbacks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文