How to post form field data (name, email,phonenumber,score) through ASI开发者_如何学GoHTTPRequest. I am using json webservices.
Try this , assign variable in your header class
ASIFormDataRequest *requestASI;
in your .m file
-(void)startASIRequest {
NSString *strUrl = [NSString stringWithFormat:@"http://your url"];
NSURL *url = [NSURL URLWithString:strUrl];
[self setRequestASI:[ASIFormDataRequest requestWithURL:url]];
[requestASI setDelegate:self];
[requestASI setRequestMethod:@"POST"];
[requestASI setPostValue:@"1" forKey:@"name"];
[requestASI setDidFailSelector:@selector(uploadFailed:)];
[requestASI setDidFinishSelector:@selector(uploadFinished:)];
[requestASI startAsynchronous];
- (void)uploadFinished:(ASIHTTPRequest *)theRequest {
NSLog(@"registerFinished %@",[theRequest responseString]);
}
- (void)uploadFailed:(ASIHTTPRequest *)theRequest {
NSLog(@"registerFailed %@", [theRequest error]);
}
精彩评论