美文网首页
基本请求设置

基本请求设置

作者: Hurricane_4283 | 来源:发表于2020-12-09 15:47 被阅读0次

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

    相关文章

      网友评论

          本文标题:基本请求设置

          本文链接:https://www.haomeiwen.com/subject/acvhgktx.html