(void)connection:(NSURLConnection *)connectiondidReceiveAuthentication Challenge:(NSURLAuthenticationChall enge*)challenge
{
NSString* username =@"Private";
NSString* password =@"aaa";
NSURLCredential * cre =[[NSURLCredential alloc] initWithUser:usernamepassword:password
persistence:NSURLCredentialPersisten ceNone];
[[challenge sender]useCredential:creforAuthenticationChallen ge:challenge];
}
如果用户名或密码输入错误如下:
想判断是否失败就
if ([challengefailureResponse])
{
NSLog(@"fail");
}
{
NSString* username =@"Private";
NSString* password =@"aaa";
NSURLCredential * cre =[[NSURLCredential alloc] initWithUser:usernamepassword:password
[[challenge sender]useCredential:creforAuthenticationChallen
}
如果用户名或密码输入错误如下:
想判断是否失败就
if ([challengefailureResponse])
{
}