im using this code to post data to my server
NSURL *mainurl = [NSURL URLWithString:@"http://xxxxxxxxxx/api/PhonePaymentApi/Transaction/"];
NSString * postdata = [[NSString alloc]initWithFormat:@"UniqueId=%@&jsonProduct=%@&BranchId=%@&OrderToTime=%@",GETUnicidentifire,JsonOrderDetail,BranchId,OrderToTime];
ASIFormDataRequest *requestt = [ASIFormDataRequest requestWithURL:mainurl];
[requestt setRequestMethod:@"POST"];
[requestt addRequestHeader:@"application/x-www-form-urlencoded" value:@"Content-Type"];
[requestt appendPostData:[postdata dataUsingEncoding:NSUTF8StringEncoding]];
NSString * theurl = [NSString stringWithFormat:@"%@",mainurl];
NSURLRequest *thereqest = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:theurl]];
[NSURLConnection connectionWithRequest:thereqest delegate:self];
in the method
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"%@",error);
}
im geting: {Message:The requested resource does not support http method 'GET'.}
what im doing Wrong ?
You are mixing things up here. You build an
ASIFormDataRequest, but you don't actually send it. What you do send is anNSURLConnection.It's been a long time since I've used ASI, but this might help:
As a word of advice, replace ASI with something like AFNetworking. ASI is no longer being developed.