0

Facing crash issue while loading set of images with urls with asyncImageView. The error I am getting is -[__NSCFString isFileURL]: unrecognized selector sent to instance

in cellForRowAtIndexPath

 UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"MyCell"];
  #define IMAGE_VIEW_TAG 99
  if (cell==nil)
  {
    cell=[[UITableViewCell alloc]initWithFrame:CGRectZero];

    AsyncImageView *imageView = [[AsyncImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 44.0f, 44.0f)];
    imageView.contentMode = UIViewContentModeScaleAspectFill;
    imageView.clipsToBounds = YES;
    imageView.tag = IMAGE_VIEW_TAG;
    [cell addSubview:imageView];
  }
  cell.textLabel.text = [arrTweets objectAtIndex:indexPath.row];
  cell.textLabel.numberOfLines=0;
  NSString *urlString=[arrProfilePics objectAtIndex:indexPath.row];
  NSURL *url = [NSURL URLWithString:urlString];

  AsyncImageView *imageView = (AsyncImageView *)[cell viewWithTag:IMAGE_VIEW_TAG];

  [[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:imageView];
  imageView.imageURL = [arrProfilePics objectAtIndex:indexPath.row];
Code cracker
  • 3,105
  • 6
  • 37
  • 67
  • are you sure that arrProfilePics is not nil? – Ilario Feb 21 '15 at 10:25
  • i checked that , pics urls array is not null and all are valid urls – Code cracker Feb 21 '15 at 10:29
  • imageView.imageURL want a NSString or NSURL? because you doing NSString *urlString = [arrProfilePics objectAtIndex:indexPath.row]; and after imageView.imageURL = [arrProfilePics objectAtIndex:indexPath.row]; ... maybe should be imageView.imageURL = url; ? – Ilario Feb 21 '15 at 10:31

1 Answers1

2

I think you are using NSString as NSURL.

Jitendra
  • 2,226
  • 1
  • 11
  • 9