Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios ASP.Net表单中的post方法,但未向服务器发送数据_Ios_Objective C_Afnetworking - Fatal编程技术网

Ios ASP.Net表单中的post方法,但未向服务器发送数据

Ios ASP.Net表单中的post方法,但未向服务器发送数据,ios,objective-c,afnetworking,Ios,Objective C,Afnetworking,我正在使用AFNetworking向服务器发送post请求, 请求成功,但未向服务器发送任何数据。 响应字符串是html表单本身和 表格中填写了我发送给服务器的值 这是代码 NSURL *url = [NSURL URLWithString:@"http://www.example.com"]; AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url]; NSDictionary *params = [NS

我正在使用AFNetworking向服务器发送post请求, 请求成功,但未向服务器发送任何数据。 响应字符串是html表单本身和 表格中填写了我发送给服务器的值

这是代码

 NSURL *url = [NSURL URLWithString:@"http://www.example.com"];
 AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];

 NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"", @"__EVENTTARGET",
                            @"", @"__EVENTARGUMENT",
                            @"", @"__LASTFOCUS",
                            self.VIEWSTATE, @"__VIEWSTATE",
                            self.subject.text, @"ctl00$ContentPlaceHolder1$messagesubject",
                            self.message.text, @"ctl00$ContentPlaceHolder1$messagetext",
                            @"yes", @"ctl00$ContentPlaceHolder1$btn_Submit",
                            nil];
[httpClient postPath:@"/post.aspx" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {

        NSString *responseStr = [[NSString alloc] initWithData:operation.responseData encoding:NSUTF8StringEncoding];

        NSLog(@"Request Successful, response '%@'", responseStr);

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

        NSLog(@"[HTTPClient Error]: %@", error.localizedDescription);            

    }];

有什么想法吗?

你能看看这个答案吗。对于ayush,我尝试了一下,但它仍然是相同的,您发送的格式和标题是什么?一个@Wain评论的例子:一些服务器要求
Accept
标题描述您想要返回的内容类型;默认情况下,AFNetworking不会发送此消息。您可能还希望查看AFHTTPRequestOperationLogger扩展,以便更容易地查看发送和接收的内容。