I have used the following code for pass json array from ios to C# mvc code. but always comes to the txtName is null
could you please explain where is the wrong??
-- C# controller code
[HttpPost]
public ActionResult SampleText(string[] txtName)
{
return Json(txtName);
}
-- ios code
(void)receiveOnAnotherThreadTestingArray:(id)sender {
NSURL *wsUrl = [NSURL URLWithString:strContactURL];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:wsUrl];
NSMutableArray *ukMakes = [NSMutableArray arrayWithObjects:@"google",@"yahoo",@"fb",
nil];
NSDictionary *dcParams222 = [NSDictionary dictionaryWithObjectsAndKeys:
ukMakes, @"txtName",
nil];
NSMutableURLRequest *afRequest = [httpClient requestWithMethod:@"POST" path:strContactURL parameters:dcParams222];
[afRequest setTimeoutInterval:5.0];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:afRequest success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON)
{
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON)
{
}];
[operation start];
}
any help appreciate..