AFNetworking请求设置请求头

NSString *url = @"INPUT URL HERE";

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

manager.requestSerializer = [AFJSONRequestSerializer serializer];

manager.responseSerializer = [AFJSONResponseSerializer serializer];

[manager.requestSerializer setValue:@"qingqiu/json" forHTTPHeaderField:@"Accept"];

[manager.requestSerializer setValue:@"zhelishiqingqiutou; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

  //查看请求头

NSLog(@"---%@",manager.requestSerializer.HTTPRequestHeaders);

[manager POST:url parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject)

{

NSLog(@"成功 ");

}

failure:^(AFHTTPRequestOperation *operation, NSError *error)

{

NSLog(@"失败 ");

}];

上一篇:XML到底是什么


下一篇:使用Visual Studio加断点调试Unity游戏的C#代码