@@ -340,7 +340,12 @@ - (void)loadImageWithConfig:(VPUPLoadImageBaseConfig *)config {
340340 }
341341 else if (image) {
342342
343- [sself setImage: image imageData: data view: sview config: blockConfig];
343+ if (data != nil ) {
344+ [sself setImage: image imageData: data view: sview config: blockConfig];
345+ }else {
346+ NSData * imageData = [sself cachePathForKeyinURL: url];
347+ [sself setImage: image imageData: imageData view: sview config: blockConfig];
348+ }
344349 [sview setNeedsLayout ];
345350 }
346351 else {
@@ -448,6 +453,37 @@ - (void)loadImageWithConfig:(VPUPLoadImageBaseConfig *)config {
448453
449454}
450455
456+ - (NSData * _Nullable)cachePathForKeyinURL : (nullable NSURL *)url {
457+
458+ NSString * key = [webImageManager () cacheKeyForURL: url];
459+
460+ NSData * iamgeData = nil ;
461+ if (key.length > 0 ) {
462+ NSSDImageCache *imageCache = [[NSSDImageCache alloc ]initWithNamespace:@" videopls" ];
463+
464+ SEL cachePath = @selector (cachePathForKey: );
465+ SEL defaultCachePath = @selector (defaultCachePathForKey: );
466+
467+ if ([[imageCache class ] instanceMethodSignatureForSelector: cachePath] != nil ) {
468+ IMP imp = [imageCache methodForSelector: cachePath];
469+ NSString *(*func)(id ,SEL ,NSString *) = (void *)imp;
470+ NSString * filePath = func (imageCache,cachePath,key);
471+ iamgeData = [NSData dataWithContentsOfFile: filePath];
472+ // NSLog(@"filePath: %@",filePath);
473+
474+ }else if ([[imageCache class ] instanceMethodSignatureForSelector: defaultCachePath] != nil ) {
475+ IMP imp = [imageCache methodForSelector: defaultCachePath];
476+ NSString *(*func)(id ,SEL ,NSString *) = (void *)imp;
477+ NSString * filePath = func (imageCache,defaultCachePath,key);
478+ iamgeData = [NSData dataWithContentsOfFile: filePath];
479+ // NSLog(@"filePath: %@",filePath);
480+ }
481+
482+ }
483+ return iamgeData;
484+ }
485+
486+
451487#endif
452488
453489- (void )clearMemory {
0 commit comments