我將如何去在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