2015-03-25 34 views
1

我看到编译器警告“实例方法-cacheKeyForURL未发现”和“实例方法-defaultCachePathForKey没有发现”,在下面的代码:为什么编译器报告SDWebImageManager的defaultCachePathForKey找不到?

SDWebImageManager *manager = [SDWebImageManager sharedManager]; 
NSString *cacheKey = [manager cacheKeyForURL:[NSURL URLWithString:imageUrl]]; 
NSString *cachePath = [[manager imageCache] defaultCachePathForKey:cacheKey]; 

enter image description here

然而显然,这些方法定义。这里,例如,是method definition in SDImageCache.h

/** 
* Get the default cache path for a certain key 
* 
* @param key the key (can be obtained from url using cacheKeyForURL) 
* 
* @return the default cache path 
*/ 
- (NSString *)defaultCachePathForKey:(NSString *)key; 

在我的代码文件,我包括从SDWebImage项目相关文件的顶部:

#import <SDWebImage/UIImageView+WebCache.h> 
#import <SDWebImage/SDImageCache.h> 
#import <SDWebImage/SDWebImageManager.h> 

而且,在SDWebImageManager.hsharedImageManageris defined编译器没有发现它的问题。我只在第二和第三行发出警告。

我的代码运行良好,这些方法都可以正常工作而不会崩溃。为什么编译器告诉我它找不到它?

我正在运行XCode 6,仅针对Active Architecture Only,iPhone 6模拟器进行编译。

UPDATE

当我编译配送,“所有结构”,一下子就可以找到cacheKeyForURLdefaultCachePathForKey,没有问题,但setImageWithURL现在已经过时?

enter image description here

我确实看到了deprecation warnings in UIImageView+WebCache.h,但我只是超级困惑,为什么建设这些不同的架构被打开/关闭各种编译器警告时似乎SDWebImage的头文件不具有任何体系结构特定于他们。

+1

你使用的是哪个版本的SDWebImage?在新版本中有一个'sd_setImageWithURL'.So你可以证实这一点。你可以使用这个链接https://github.com/rs/SDWebImage – 2015-03-25 04:29:53

+0

版本3.7.1,根据Podfile.lock – esilver 2015-03-25 17:11:21

回答

1

我通过更仔细地检查“Report Navigator”(neéLog Navigator)中的错误来解决这个问题。

enter image description here

事实证明,有在“导出数据”文件夹中的一些很老的SDWebImageManager.h文件,它被选择来链接。不清楚为什么他们没有离开我的项目清理。 (可能与我通过Cocoapods从子模块迁移到包括SDWebImage的事实有关?)

I used this answer on Stack Overflow导航到我的DerivedData文件夹,然后手动删除我的项目的子文件夹。这样做之后,该项目现在可以成功建立,而不会产生虚假警告。

相关问题