我想使用 JSON 将 NSDictionary 或 NSArray 参数发送到带有 AFNetworking 的 PHP 服务器
问问题
98 次
1 回答
0
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"https://www.url.com/"]];
NSDictionary *parameter = @{@"key1":@"value1", @"key2",@"value2"};
[httpClient setParameterEncoding:AFJSONParameterEncoding];
[httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]];
[httpClient postPath:@"some/path" parameters:parameter success:^(AFHTTPRequestOperation *operation, id responseObject) {
....
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
....
}];
于 2013-10-20T04:42:40.463 回答