-4
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  return dict.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

  static NSString *simpleTableIdentifier = @"RestaurantResultsCell";
  RestaurantDetailsViewCell *cell = (RestaurantDetailsViewCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
  if (cell == nil) {
      NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"restaurantDetailsCell" owner:self options:nil];
      cell = [nib objectAtIndex:0];
  }

  arrResponse =[NSArray arrayWithObject:dict];
  arr = [arrResponse objectAtIndex:0];

  dictio = [arr objectAtIndex:0];

  cell.cusineRestLabel.text = [[dictio valueForKey:@"restaurant_name"]objectAtIndex:indexPath.row];

  NSLog(@"cell is %@",cell.cusineRestLabel.text);

  //    cell.cusineRestLabel.text = [dic objectForKey:@"restaurant_name"];

  cell.cusineRestAddress.text = [dictio valueForKey:@"restaurant_streetaddress"];

  NSLog(@"cell is %@",cell.cusineRestAddress.text);

  cell.cusineDeliveryTime.text = [dictio valueForKey:@"restaurant_delivery"];

  NSLog(@"cell is %@",cell.cusineDeliveryTime.text);

  return cell;
}

after executing for the first time [__NSArrayI length]: unrecognized selector sent to instance

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 3
    Really? Where is your question? Edit your question and ask in a proper way. – Candost Sep 05 '15 at 11:45
  • 1
    Reformat the code, ask a question, provide a useful error explanation (at what line),show some effort! – luk2302 Sep 05 '15 at 11:48
  • after return cell the control goes to closed bracket after that it should go up and reexecute all the lines but crashes – dilshad haidari Sep 05 '15 at 11:53
  • Hahaha, WHAT? Have you read our comments? – luk2302 Sep 05 '15 at 12:21
  • 1
    do not use a dictionary as data source. You will get the items in a random order because a dictionary is unordered. – vadian Sep 05 '15 at 12:23
  • possible duplicate of [How can I debug 'unrecognized selector sent to instance' error](http://stackoverflow.com/questions/25853947/how-can-i-debug-unrecognized-selector-sent-to-instance-error) – Hot Licks Sep 05 '15 at 12:24
  • So `dict` is, in fact, an array? That's some terrible code. – trojanfoe Sep 05 '15 at 15:34
  • Are arrResponse, dict, dictio etc. all instance variables? That's horrible. Instance variables should start with an underscore. And most likely these shouldn't be instance variables in the first place. – gnasher729 Sep 05 '15 at 16:28

1 Answers1

1

This code

  arrResponse =[NSArray arrayWithObject:dict];
  arr = [arrResponse objectAtIndex:0];

is a very strange way to write

  arr = (id)dict;

which looks not like a bug, but intentional obfuscation. So what is it: An array or a dictionary?

gnasher729
  • 51,477
  • 5
  • 75
  • 98