AFHTTPRequestOperaionManager 缓存问题



 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    manager.requestSerializer.cachePolicy = NSURLRequestReturnCacheDataDontLoad;
    AFHTTPResponseSerializer *responseSerializer = [AFHTTPResponseSerializer serializer];
    responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    manager.responseSerializer = responseSerializer;
    [manager GET:@"http://www.github.com" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"%@", [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding]);

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

    }];

为何我即使设置cachePolicy为DontLoad,这段代码执行时仍然会从服务器读取数据

ios afnetworking2.0

铃仙兔萌娘 9 years, 12 months ago
飞机-肥鸡 answered 9 years, 12 months ago

Your Answer