3

我想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 链接器错误。什么是 Apple Mach-O 链接器错误?在 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"]];
4

0 回答 0