YTKNetwork icon indicating copy to clipboard operation
YTKNetwork copied to clipboard

loadCacheMetadata

Open miaoruiyuan opened this issue 6 years ago • 5 comments

获取缓存 这个方法总是返回NO ???

miaoruiyuan avatar Jul 06 '18 02:07 miaoruiyuan

/// The max time duration that cache can stay in disk until it's considered expired. /// Default is -1, which means response is not actually saved as cache.

  • (NSInteger)cacheTimeInSeconds; //检测一下这个参数是否设置了

/// @return Whether cache is successfully loaded.

  • (BOOL)loadCacheWithError:(NSError * __autoreleasing *)error; //可以使用这个检测哪里出错了 @miaoruiyuan

webMing avatar Aug 12 '18 08:08 webMing

@webMing cacheTimeInSeconds 设置确认没问题

error Domain=com.yuantiku.request.caching Code=-6 "Invalid metadata. Cache may not exist" UserInfo={NSLocalizedDescription=Invalid metadata. Cache may not exist}

想知道问题出在哪?谢谢

miaoruiyuan avatar Sep 06 '18 05:09 miaoruiyuan

你的cacheTimeInSeconds 设置的是多少?把代码片段贴一些ok?

webMing avatar Sep 08 '18 09:09 webMing

我也是,不知道什么原因。

FlyingCaiChong avatar Apr 04 '19 09:04 FlyingCaiChong

@FlyingCaiChong 好像responseObject 必须是NSData类型

miaoruiyuan avatar Apr 04 '19 10:04 miaoruiyuan