我将如何去在Objective-CObjective-C的HTTP基本身份验证
curl -u [email protected]:mypassword http://foo.lighthouseapp.com/projects.xml
我一直在玩与周围的ASIHTTPRequest库,但似乎无法弄清楚复制此,
明显发送我的要求,像这样将返回认证错误:
-(void)submit:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://ldn.lighthouseapp.com/projects/63254-londonist-20/tickets.xml"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
NSLog(@"response:%@",response);
} else {
NSLog(@"error:%@",error);
}
}
这可能是非常简单的我只是失去了一些东西非常重大的
感谢它真的帮助了我 – mohitum 2013-02-15 06:26:37