不能使用sdwebimage类别(mach链接器错误)

时间:2013-01-26 19:28:26

标签: ios linker-errors sdwebimage

我想将SDWebImage用于我的图片浏览,以便我可以从网络上获取图片。我从github下载了zip,解压缩它。我将文件从SDWebImage文件夹拖到xcode中,检查了复制项目,还检查了我的目标。然后,我使用#import "UIImageView+WebCache.h"进行了导入。我做了两个UIImageViews我正在使用方法

[self.sdFeedImageView setImageWithURL:[NSURL URLWithString:feed.pictureURL]placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

但是当我试图运行我的项目时,构建失败了8个Apple Mach-O Linker错误。什么是Apple Mach-O Linker错误?在xcode的左侧窗格中选择错误后,我看到了这个:

Undefined symbols for architecture i386:
  "_CGImageSourceCopyPropertiesAtIndex", referenced from:
      ___59-[SDWebImageDownloaderOperation connection:didReceiveData:]_block_invoke_0 in SDWebImageDownloaderOperation.o
  "_CGImageSourceCreateImageAtIndex", referenced from:
      ___59-[SDWebImageDownloaderOperation connection:didReceiveData:]_block_invoke_0 in SDWebImageDownloaderOperation.o
  "_CGImageSourceCreateIncremental", referenced from:
      ___59-[SDWebImageDownloaderOperation connection:didReceiveData:]_block_invoke_0 in SDWebImageDownloaderOperation.o
  "_CGImageSourceUpdateData", referenced from:
      ___59-[SDWebImageDownloaderOperation connection:didReceiveData:]_block_invoke_0 in SDWebImageDownloaderOperation.o
  "_OBJC_CLASS_$_MKAnnotationView", referenced from:
      l_OBJC_$_CATEGORY_MKAnnotationView_$_WebCache in MKAnnotationView+WebCache.o
  "_kCGImagePropertyPixelHeight", referenced from:
      ___59-[SDWebImageDownloaderOperation connection:didReceiveData:]_block_invoke_0 in SDWebImageDownloaderOperation.o
  "_kCGImagePropertyPixelWidth", referenced from:
      ___59-[SDWebImageDownloaderOperation connection:didReceiveData:]_block_invoke_0 in SDWebImageDownloaderOperation.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

修改 这是代码:

self.sdUserImageView=[[UIImageView alloc]initWithFrame:CGRectMake(18, 26, 51, 51)]; [self.contentView addSubview:self.sdUserImageView];
self.sdFeedImageView=[[UIImageView alloc]initWithFrame:CGRectMake(18, 110, 284, 174)]; [self.contentView addSubview:self.sdFeedImageView];

然后

[self.sdUserImageView setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"graph.facebook.com/%@/… imageNamed:@"placeholder.png"]];

0 个答案:

没有答案