更新时间:2023-02-16 10:15:00
搜索文档并尝试一些代码后我作为示例
after searching docs and trying out some codes I got following as an example
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
NSDictionary *params = @ {@"user" :txtUserName, @"pwd" :txtPwd };
[manager POST:URL_SIGNIN parameters:params
success:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"JSON: %@", responseObject);
}
failure:
^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
另外,不要忘记在服务器脚本中将响应头类型设置为Application / json。
Also don't forget to set response header type in the server script as Application/json.