It was the main firework for me. I looked at all of these similar questions on SO, and none of them turned out to be satisfactory. Here I am.
I have a great setup for rails 3 with Authlogic.
I use Objective Resource (http://iphoneonrails.com/) to connect my iPhone application and my Rails application, and it works great.
It is time to add authentication, and I can’t understand.
I have a UserSession class in my iPhone project with a username and password field. When the application starts, I present a login screen with username and password fields. When a button is clicked, the iPhone application tries to create a UserSession.
I took my code for this from 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"); }
When I run this code, “0” and “screams, error” are displayed in the log, which means that the UserSession was not saved. This happens for both correct and incorrect login.
In addition, I put token comments in saveRemote ("I'm in saveRemote", etc.) and they never appear in my journal.
Any ideas here?
If you want me to post more code let me know. I will be all night with this.
source share