我对网络之类的东西非常缺乏经验,所以请善待。
我正在尝试使用以下表单数据发送发布请求
{"email":"JoeSmith@aol.com","password":"password","password_confirm":"password","name":"Joe Smith","cellphone":"4402415585","address":"Fake Street"}:
到目前为止,这是我所拥有的:
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",SERVER_ADDRESS]] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:10];
[request setHTTPMethod: @"POST"];
NSURLConnection *connection = [NSURLConnection connectionWithRequest:request delegate:self];
[connection start];
我的问题是我无法弄清楚如何在此请求中包含表单数据。我确信NSMutableURLRequest
可以使用一种简单的方法,但我无法弄清楚是哪一种。