您好我正在使用ASIHTTPRequest POST添加登錄用戶的basecamp時間條目。 ASIHTTPRequest的 但ASIHTTPRequest POST基地營
- (void)request:(ASIHTTPRequest *)request didReceiveResponseHeaders:(NSDictionary *)responseHeaders
方法獲取調用和
- (void)requestFailed:(ASIHTTPRequest *)request
爲拒絕訪問我收到錯誤。
我還需要發送aunthentication令牌basecamp URl請幫助我如何做到這一點。
NSString *postData=[NSString stringWithFormat: @"<time-entry>\
<person-id> 898989 </person-id>\
<date>2011-04-07</date>\
<hours>2:00</hours>\
<description>test</description>\
</time-entry>"];
NSURL *url = [NSURL URLWithString:@"https://test.basecamphq.com/projects/4644/time_entries.xml"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setDelegate:self];
[request setRequestMethod:@"POST"];
[request appendPostData:[postData dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]];
[request addRequestHeader:@"Accept" value:@"application/xml"];
[request addRequestHeader:@"Content-Type" value:@"application/xml"];
[request authenticationNeeded];
[request setValidatesSecureCertificate:NO];
[request startAsynchronous];
這是我的代碼。請幫忙。