- (void)postRequest{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
// >>>>>>>> post 发送json格式数据的时候加上
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
// <<<<<<<<
[manager.requestSerializer setValue:@"token_String" forHTTPHeaderField:@"Authorization"];
NSString *url = @"";
NSDictionary *postData = @{@"data1":@"one",@"data2":@"two"};
[manager POST:url parameters:postData progress:^(NSProgress * _Nonnull uploadProgress) { } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { }];
}
05-11 18:24