I'm a newcomer to the iPhone world. I'm working on an application having a login pa开发者_C百科ge. I have to send UIText
value of username and password to the server. Code would be appreciated.
Look into using the ASIHTTPRequest framework to make POST requests.
You can check the user_ name and password from the severer ASIHTTPRequest framework it's the ex. of code which from the twitter request.m file
if ([challenge previousFailureCount] == 0) {
NSURLCredential *newCredential;
newCredential=[NSURLCredential credentialWithUser:[self username]
password:[self password]
persistence:NSURLCredentialPersistenceNone];
[[challenge sender] useCredential:newCredential
forAuthenticationChallenge:challenge];
[newCredential release];
} else {
[[challenge sender] cancelAuthenticationChallenge:challenge];
// inform the user that the user name and password
// in the preferences are incorrect
NSLog(@"Invalid Username or Password");
}
精彩评论