我将如何在objective-c中复制它
curl -u rick@email.com: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);
}
}
这可能很简单,我只是错过了一些非常重要的东西