저는 아이폰 개발에 멍청한 사람이고 SDWebImage 라이브러리를 프로젝트에 구현하려고합니다. 그러나 내 tableview 표시 할 때 내 응용 프로그램이 잘못된 인수 예외가 충돌합니다. 나는 철저히 설치 지침을 따랐다. ImageIO 프레임 워크를 추가하고 프로젝트가 ARC가 아니므로 -fobjc-arc 플래그를 추가하고 적절한 헤더를 가져 왔습니다. 어떤 도움이라도 대단히 감사합니다. 당신이 사용하는 경우 (UITableView를 사용하는 SDWebImage에서 예외가 발생하는 이유는 무엇입니까?
#import <SDWebImage/UIImageView+WebCache.h>
:
MY 예외
'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x6e47d50'
내 코드 해당 파일의 상단 내부
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
//Lazy Loader
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"mylogo.png"]];
// Configure the cell...
NSDictionary *aTweet = [tweets objectAtIndex:[indexPath row]];
cell.textLabel.text = [aTweet objectForKey:@"text"];
cell.textLabel.adjustsFontSizeToFitWidth = YES;
cell.textLabel.font = [UIFont systemFontOfSize:12];
cell.textLabel.minimumFontSize = 10;
cell.textLabel.numberOfLines = 4;
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.detailTextLabel.text = [aTweet objectForKey:@"from_user"];
NSURL *url = [NSURL URLWithString:[aTweet objectForKey:@"profile_image_url"]];
NSData *data = [NSData dataWithContentsOfURL:url];
cell.imageView.image = [UIImage imageWithData:data];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
앞으로 ARC를 사용하는 것이 좋습니다. 더 쉽게 작업 할 수 있습니다. 훨씬 쉽습니다. – dotbill
나는 여기에 대답했다 : http://stackoverflow.com/questions/18400602/sdwebimage-sending-unknown-exception –