Can't use sdwebimage category (machine linker errors)

I want to use SDWebImage

for my images so that I can receive images from the internet. I downloaded the zip from github, unzipped it. I have dragged files from SDWebImage folder to xcode, checked copy items and also checked my target. Then I did an import with #import "UIImageView+WebCache.h"

. I did two UIImageViews

and I am using the method

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

But when I tried to run my project, the build failed with 8 Apple Mach-O Linker errors. What is Apple Mach-O Linker Error? Selecting the error in the left pane of xcode I see the following:

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)

      

Edit: Here is the code:

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];

      

then

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

      

+3


source to share





All Articles