私はログイン認証にASIHttprequestを使用していますこれがdemeコードです
私が試しているコードは次のとおりです。
[self setRequest:[ASIHTTPRequest requestWithURL:url1]];
[_request setUseKeychainPersistence:[useKeychain isOn]];
[_request setDelegate:self];
[_request setShouldPresentAuthenticationDialog:[useBuiltInDialog isOn]];
[_request setDidFinishSelector:@selector(topSecretFetchComplete:)];
[_request setDidFailSelector:@selector(topSecretFetchFailed:)];
[_request startAsynchronous];
[request setValidatesSecureCertificate:NO];
[_request setValidatesSecureCertificate:NO];
Request failed および Request complete メソッド
- (IBAction)topSecretFetchFailed:(ASIHTTPRequest *)theRequest{
[responseField setText:[[request error] localizedDescription]];
[responseField setFont:[UIFont boldSystemFontOfSize:12]];
}
- (IBAction)topSecretFetchComplete:(ASIHTTPRequest *)theRequest{
[responseField setText:[request responseString]];
[responseField setFont:[UIFont boldSystemFontOfSize:12]];
NSLog(@"Response :%@",[request responseString]);
}
- (void)authenticationNeededForRequest:(ASIHTTPRequest *)theRequest{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Please Login" message:[request authenticationRealm] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil];
[alertView addTextFieldWithValue:@"" label:@"Username"];
[alertView addTextFieldWithValue:@"" label:@"Password"];
[alertView show];
}
私はiosが初めてなのでお願い
します......このデモでは、クロックを上げたときに1つのアラートがポップアップしますが、Webサービスを使用すると、次のような応答が返されます
応答:ASIHTTPRequest: 0xa846400
ただし、ユーザー名とパスワードを入力するためのアラートビューをポップアップしません
ログインを認証するための他のより良い方法があれば、私に提案してください
ログインをルートビューとして配置したいのですが、ログインに成功した後、アプリに入ることができます
ありがとう...