我尝试制作一个可以登录到使用 https 保护用户信息的 Web 应用程序的 iphone 应用程序。现在我被困在登录页面中。通过我的应用程序登录时,我不知道如何在用户的网站上查看真实帐户。即使我输入了错误的帐户,我也只收到了 200 条回复。
这是我的代码:
- (IBAction)clickOK:(id)sender {
NSURL *url = [NSURL URLWithString:@"https://www.freelancer.com/users/login.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setUseKeychainPersistence:YES];
[request setDelegate:self];
request.shouldPresentCredentialsBeforeChallenge = YES;
[request setRequestMethod:@"POST"];
[request setPostValue:usernameField.text forKey:@"username"];
[request setPostValue:passwordField.text forKey:@"passwd"];
request.timeOutSeconds = 30;
[request setDidFailSelector:@selector(requestLoginFailed:)];
[request setDidFinishSelector:@selector(requestLoginFinished:)];
[request startAsynchronous];
}
- (void)requestLoginFailed:(ASIHTTPRequest *)request
{
//notify user
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Error sending request to the server" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
- (void)requestLoginFinished:(ASIHTTPRequest *)request
{
int statusCode = [request responseStatusCode];
NSString *statusMessage = [request responseStatusMessage];
NSLog(@"StatusCode: %d", statusCode);
NSLog(@"StatusMessage: %@", statusMessage);
}
谁能建议我如何检查本网站的真实帐户并保持用户登录?
谢谢你的帮助