Authlogic 和 iPhone 应用程序登录 [英] Authlogic and iPhone app login

查看:63
本文介绍了Authlogic 和 iPhone 应用程序登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我很头疼.我已经查看了关于 SO 的所有类似问题,但没有一个证明是令人满意的.这是我的目标.

This has been a head-banger for me. I have looked at all of the similar questions on SO and none have proved satisfactory. Here's my go at it.

我使用 Authlogic 设置了完美的 rails 3 应用程序.

I have a perfectly fine rails 3 app setup with Authlogic.

我一直在使用 Objective Resource (http://iphoneonrails.com/) 来连接我的 iPhone 应用程序和 Rails 应用程序,并且运行良好.

I have been using Objective Resource (http://iphoneonrails.com/) to connect my iPhone app and my Rails app, and it has been working fine.

现在是添加身份验证的时候了,我无法弄清楚.

Now is the time to add authentication, and I cannot figure it out.

我的 iPhone 项目中有一个带有用户名和密码字段的 UserSession 类.当应用程序启动时,我会显示一个带有用户名和密码字段的登录屏幕.单击按钮后,iPhone 应用程序会尝试创建 UserSession.

I have a UserSession class in my iPhone project with a username and password field. When the app launches, I present a login screen with username and password fields. Upon clicking a button, the iPhone app attempts to create the UserSession.

我从 http://www.corprew.org/blog/2010/01/27/authlogic-and-objectiveresource/

us.username = usernameField.text;
us.password = passwordField.text;

NSError * err = nil;


if(![us saveRemoteWithResponse:&err])
{
    NSLog(@"%d", err);
    NSLog(@"whoops, error");

} 

当我运行该代码时,日志显示0"和哎呀,错误",这意味着 UserSession 没有保存.正确和不正确的登录都会发生这种情况.

When I run that code, the Log shows "0" and "whoops, error" meaning that the UserSession did not save. This occurs for both correct and incorrect logins.

此外,我在 saveRemote 中放置了标记注释(我在 saveRemote"等),并且这些注释从未出现在我的日志中.

Additionally, I have placed token comments in saveRemote ("I'm in saveRemote" etc.) and those never appear in my log.

这里有什么想法吗?

如果您想让我发布更多代码,请告诉我.我会带着这个彻夜难眠.

If you want me to post anymore code, let me know. I will be up all night with this one.

推荐答案

问题已解决.

不要使用 ObjectiveResource :-)

Don't use ObjectiveResource :-)

切换到 ASIHTTP,它现在可以很好地满足我的需求.

Switched to ASIHTTP and it's working fine for my needs right now.

这篇关于Authlogic 和 iPhone 应用程序登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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