我看到编译器警告“实例方法-cacheKeyForURL未发现”和“实例方法-defaultCachePathForKey没有发现”,在下面的代码:为什么编译器报告SDWebImageManager的defaultCachePathForKey找不到?
SDWebImageManager *manager = [SDWebImageManager sharedManager];
NSString *cacheKey = [manager cacheKeyForURL:[NSURL URLWithString:imageUrl]];
NSString *cachePath = [[manager imageCache] defaultCachePathForKey:cacheKey];
然而显然,这些方法定义。这里,例如,是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.h
和sharedImageManager
is defined编译器没有发现它的问题。我只在第二和第三行发出警告。
我的代码运行良好,这些方法都可以正常工作而不会崩溃。为什么编译器告诉我它找不到它?
我正在运行XCode 6,仅针对Active Architecture Only,iPhone 6模拟器进行编译。
UPDATE
当我编译配送,“所有结构”,一下子就可以找到cacheKeyForURL
和defaultCachePathForKey
,没有问题,但setImageWithURL
现在已经过时?
我确实看到了deprecation warnings in UIImageView+WebCache.h,但我只是超级困惑,为什么建设这些不同的架构被打开/关闭各种编译器警告时似乎SDWebImage的头文件不具有任何体系结构特定于他们。
你使用的是哪个版本的SDWebImage?在新版本中有一个'sd_setImageWithURL'.So你可以证实这一点。你可以使用这个链接https://github.com/rs/SDWebImage – 2015-03-25 04:29:53
版本3.7.1,根据Podfile.lock – esilver 2015-03-25 17:11:21