2017-07-14 52 views
0

我已更新我的pod文件。因此,我的sdwebimage pod文件已更新至4.0,现在我收到很多无法识别的问题并解决了大部分问题。SDImageView - 4.0升级后无法识别的错误

现在我需要一些想法来解决以下问题。

功能的验证码我要检查图像是否已经或不下载与URL的帮助下,我使用下面的代码

-(BOOL) isDownloadComplete:(NSString*)downloadmediaURL 
{ 
    BOOL downloaded = NO; 
    NSString * url = [NSString stringWithFormat:@"%@",downloadmediaURL]; 
    NSString * aURL = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]; 


    SDWebImageManager *manager = [SDWebImageManager sharedManager]; 

    if (![manager cachedImageExistsForURL:[NSURL URLWithString:aURL]]) 
    { 

     downloaded = NO; 
    } 
    else 
    { 

     downloaded = YES; 


    } 

    return downloaded; 
} 

但是我现在在越来越无法识别的问题下面一行

if (![manager cachedImageExistsForURL:[NSURL URLWithString:aURL]]) 

让知道我可以在来这个问题

在此先感谢

+0

什么错误? –

+0

我需要这个函数作为BOOL函数。现在它被替换为void函数,我无法在加载该特定页面时检查该条件 – btmanikandan

回答

0

SDWebImage 4.0.0是一个主要版本,方法cachedImageExistsForURL:被更改为具有完成处理程序。

/** 
* Async check if image has already been cached 
* 
* @param url    image url 
* @param completionBlock the block to be executed when the check is finished 
* 
* @note the completion block is always executed on the main queue 
*/ 
- (void)cachedImageExistsForURL:(nullable NSURL *)url 
        completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock; 

您可以使用它像这样 -

[manager cachedImageExistsForURL:[NSURL URLWithString:aURL] completion:(Bool isInCache) { 
    if (isInCache) { 
    //Image present in cache 
    } 
}] 
相关问题