samedi 26 avril 2014

iOS - impossible d'utiliser sdwebimage catégorie (erreurs de l'éditeur de liens de mach) - Stack Overflow


I want to use SDWebImage for my imageviews so that i can get images from the web. I downloaded the zip from github, unzipped it. I dragged files from SDWebImage folder into xcode, checked copy items, and also checked my target. Then, I did an import with #import "UIImageView+WebCache.h". I made 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 a Apple Mach-O Linker error? Upon choosing an error in the left pane of xcode, I see the this:


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


I want to use SDWebImage for my imageviews so that i can get images from the web. I downloaded the zip from github, unzipped it. I dragged files from SDWebImage folder into xcode, checked copy items, and also checked my target. Then, I did an import with #import "UIImageView+WebCache.h". I made 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 a Apple Mach-O Linker error? Upon choosing an error in the left pane of xcode, I see the this:


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

0 commentaires:

Enregistrer un commentaire