0
私はjson APIからデータを取得して、テーブルビューの製品を表示する単純なアプリケーションで作業しています。問題は、画像の同期ダウンロードのためにテーブルが遅くなることです。これを解決するためにSDWebimageフレームワークを使用しようとしているが、私はこのエラーを取得イム:非同期画像ダウンローダエラーObj-c SDWebimage
「『NSInvalidArgumentException』、理由:「 - [UIImageView sd_setImageWithURL:placeholderImage:]:認識されていないセレクタがインスタンスに送信」
私が持っているコードこれは、次のとおりです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
NSDictionary *dictionary = [self.json objectAtIndex:indexPath.row];
cell.textLabel.text=[dictionary objectForKey:@"name"];
cell.detailTextLabel.text = [dictionary objectForKey:@"description"];
//old synchronous code
/* NSString *path = [[[[dictionary objectForKey:@"images"] objectAtIndex:0] valueForKey:@"thumb"] valueForKey:@"url"];
NSString *ruta = [NSString stringWithFormat:@"http://18.221.78.126/ecoferia%@",path];
NSURL *url = [NSURL URLWithString:ruta];
NSData *imgData = [NSData dataWithContentsOfURL:url];
cell.imageView.image = [UIImage imageWithData:imgData];
*/
//trying to do asynchronous download of the images
NSString *path = [[[[dictionary objectForKey:@"images"] objectAtIndex:0] valueForKey:@"thumb"] valueForKey:@"url"];
NSString *ruta = [NSString stringWithFormat:@"http://18.221.78.126/ecoferia%@",path];
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:ruta]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
return cell;
}
も
私はSDWebimageはこのように私のproyectにインストールされ、.mファイルにインポートされている:
#import "SDWebImage/UIImageView+WebCache.h"
イムスーパーすべてのヒントを高く評価しています。 >その他のリンカフラグ -
よろしく..