Web から画像を取得できるように、画像ビューに使用したいと考えてSDWebImage
います。zip を github からダウンロードし、解凍しました。ファイルを SDWebImage フォルダーから xcode にドラッグし、コピー項目をチェックして、ターゲットもチェックしました。次に、でインポートを行い#import "UIImageView+WebCache.h"
ました。私は2つ作りUIImageViews
、その方法を使用しています
[self.sdFeedImageView setImageWithURL:[NSURL URLWithString:feed.pictureURL]placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
しかし、プロジェクトを実行しようとすると、8 つの Apple Mach-O Linker エラーでビルドが失敗しました。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"]];