您是否需要在 iOS 中创建与 WCF 服务上的 POST 方法相同的对象?
WCF 服务中的 POST 调用示例
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "")]
//method
Employee PostEmp(Employee emp);
[DataContract]
public class Employee
{
[DataMember]
public string firstname { get; set; }
[DataMember]
public string idkey { get; set; }
[DataMember]
public string lastname { get; set; }
[DataMember]
public string salary { get; set; }
public Employee(string first, string id, string sal, string last)
{
firstname = first;
idkey = id;
salary = sal;
lastname = last;
}