基本请求设置

 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];

你可能感兴趣的:(基本请求设置)