Làm thế nào tôi sẽ đi về sao chép này trong Objective-CObjective-c xác thực HTTP Basic
curl -u [email protected]:mypassword http://foo.lighthouseapp.com/projects.xml
Tôi đã chơi đùa với các thư viện ASIHTTPRequest nhưng dường như không thể hình dung nó ra,
rõ ràng gửi yêu cầu của tôi như vậy trả về một lỗi xác thực:
-(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);
}
}
Đây có lẽ là rất đơn giản tôi chỉ còn thiếu một cái gì đó khá lớn
Cảm ơn nó thực sự đã giúp tôi – mohitum