2
j'appeler API web à partir de iOS, j'appelle la méthode POST, je cann't passer le paramètre dans la méthode postappel service Web reposant dans iOS
API Web:
public class Person
{
public int Id { get; set; }
public String Name { get; set; }
}
// POST api/values
public void Post([FromBody]Person value)
{
}
dans iOS
NSURL *url =[NSURL URLWithString:@"http://localhost:9281/api/values"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
[theRequest setHTTPMethod:@"POST"];
NSURLConnection *theConnection = [[NSURLConnection alloc]initWithRequest:theRequest delegate:self];
Comment passer le paramètre value Person dans POST méthode?
Dans l'avenir, vous voudrez peut-être examiner cette question pour quelque chose comme ceci: https://github.com/AFNetworking/AFNetworking – Joe