基本请求设置

2020-12-09  本文已影响0人  Hurricane_4283

 AFHTTPSessionManager *sessionManage = [AFHTTPSessionManager manager];

    sessionManage.responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingAllowFragments];

    sessionManage.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", nil];

    [sessionManage.requestSerializerwillChangeValueForKey:@"timeoutInterval"];

    sessionManage.requestSerializer.timeoutInterval = 50.0f;

    [sessionManage.requestSerializerdidChangeValueForKey:@"timeoutInterval"];

    AFJSONResponseSerializer *jsonResponse = (AFJSONResponseSerializer *)sessionManage.responseSerializer;

    jsonResponse.removesKeysWithNullValues = YES;

    AFHTTPRequestSerializer *requestSerializer = [AFHTTPRequestSerializer serializer];

    [requestSerializersetValue:@"" forHTTPHeaderField:@"X-LC-Id"];

    [requestSerializersetValue:@"" forHTTPHeaderField:@"X-LC-Key"];

    sessionManage.requestSerializer= requestSerializer;

    NSString *queryUrl = [NSString stringWithFormat:@"https://(id前八位).lncldglobal.com/1.1/classes/%@?limit=10&%@",url,searchStr];

上一篇下一篇

猜你喜欢

热点阅读