我看到編譯器警告「實例方法-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