我正在发送像这样的html字符串
summary = "
Paras
"作为POST参数,但请求每次都失败。
此请求字典由AFNetworking转换为json字符串,如
"summary" : "
Paras"
我认为可能存在问题,但我不确定。
我不知道为什么只有当我将参数作为html字符串发送时,请求才会失败。
[requestDict setObject:htmlString forKey:@"summary"];
按上述方式设置请求字典
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager.requestSerializer setTimeoutInterval:60.0];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"accessToken"] != nil)
{
// NSLog(@"%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"accessToken"]);
[manager.requestSerializer setValue:requestAuthorization forHTTPHeaderField:@"Authorization"];
}
// NSLog(@"%@", requestAuthorization);
[manager.requestSerializer setValue:@"guest" forHTTPHeaderField:@"user_type"];
[manager.requestSerializer setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[manager.requestSerializer setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forHTTPHeaderField:@"device_id"];
[manager.requestSerializer setValue:[[UIDevice currentDevice] systemVersion] forHTTPHeaderField:@"device_os"];
[manager.requestSerializer setValue:[[UIDevice currentDevice] systemName] forHTTPHeaderField:@"device_name"];
[manager POST:url parameters:parameters success:success failure:failure];
非常感谢任何帮助。
感谢