Bootstrap

ios客户端学习-AFNetWorking post 设置请求头Content-Type:application/json

+(id)sharedManager{
static ClientManager *manager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken,^{
manager = [[ClientManager alloc]initWithBaseURL:[NSURL URLWithString:@""]];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
// 设置处理返回的ContentType
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@“application/json”, @“text/json”, @“text/javascript”,@“text/html”,@“text/plain”,nil];

    // 设置请求方式Content-Type:application/json
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
});

return manager;

}

;