1

I am trying to run my app with HJCache library for asynchronous download of images over the net, but I am getting this issue after I link the delegate and dataSource to the TableView.

-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7190210 2012-11-29 00:36:41.059 HJCacheTest1[2080:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7190210'

Where could be my problem?

Firstly, I have add the HJCache Classes and ImageCell.h .m and .xib. Secondly, I have imported the classes to my ViewController.m and put this codes;

- (void)viewDidLoad
{
[super viewDidLoad];

self.imgMan = [[HJObjManager alloc] init];
NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache/imgtable/Luai/"] ;
HJMOFileCache* fileCache = [[HJMOFileCache alloc] initWithRootPath:cacheDirectory];
self.imgMan.fileCache = fileCache;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* cellIdentifier = @"ImgCell";

ImgCell *cell = (ImgCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];

if (cell == nil)
{
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:cellIdentifier owner:nil options:nil];
    cell = (ImgCell*)[nib objectAtIndex:0];
}

///// Image reloading from HJCacheClasses
[cell.img clear];
NSString *str1 = [imageArray objectAtIndex:indexPath.row];
NSString *trimmedString = [str1 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSURL *url = [NSURL URLWithString:trimmedString];
cell.img.url = url; //set the url to img view
[self.imgMan manage:cell.img];
}

Thanks from now.

Luai Kalkatawi
  • 1,492
  • 5
  • 25
  • 51

1 Answers1

1

The issue is with wrong interface builder connections.

Possible issue : You connected the view outlet of your xib to UITableView.

Possible Solution : Reconnect all xib connection.

  1. Connect view outlet to the UIView in your xib
  2. Connect tableView outlet to UItableView in your xib
  3. Connect the tableView datasource and delegate to file's owner
Midhun MP
  • 103,496
  • 31
  • 153
  • 200