title: Terminating app due to uncaught exception 'NSRangeException', reason: -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
body: <p>I am new to iOS. I am making an app in which i am getting response from json all are working fine. i am storing response in an array but when i am setting the array  value to tableview cell like this </p>
  
  <pre><code>valuedate.text=[[self.inboxmessagesarray objectAtIndex:indexPath.row]objectForKey:@"messageId"]
  </code></pre>
  
  <p>it is giving an exception what i am mistaking.Thanx in advance. below is my sample code.</p>
  
  <pre><code>-(void)viewdidload{
    NSMutableDictionary *callDict =[[NSMutableDictionary alloc] init];
      [callDict setObject:@"messages-getModuleMessages" forKey:@"call"];
      [callDict setObject:FB_API_KEY forKey:@"accessSecret"];
      NSString *x=[FBUserManager sharedUserManager].authToken;
      [callDict setObject:x forKey:@"authToken"];
      [callDict setObject:@"json" forKey:@"format"];
      [callDict setObject:@"inbox" forKey:@"callType"];
  
      FBGenericWebHandler *handler = [[FBGenericWebHandler alloc] init];
      handler.delegate = self;
      [handler Inboxmessages:callDict];
      handler = nil;
      [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  
  
  
  }
  </code></pre>
  
  <p>and i am getting response like this</p>
  
  <pre><code>-(void)inboxmessagesGetSuccess:(FBGenericWebHandler*)handler response:(NSDictionary*)response
  {
      [MBProgressHUD hideHUDForView:self.view animated:YES];
      NSMutableArray *inboxArray = [[NSMutableArray alloc] init];
     NSArray *firstarray=[[[response objectForKey:@"messageResponse"] objectAtIndex:1] objectForKey:@"messages"];
      for(NSDictionary *tmp in firstarray)
      {
          NSMutableDictionary *messages=[[NSMutableDictionary alloc]init];
          [messages setValue:[tmp objectForKey:@"messageId"] forKey:@"messageId"];
          [self.inboxmessagesarray addObject:messages];
  
  
  
  
      }
      [self.activitiesTableView_ reloadData];
  
  
  }
  </code></pre>
  
  <p>and setting my cell like this</p>
  
  <pre><code>-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  
      static NSString *tableviewidentifier = @"cell";
      tablecellTableViewCell *cell= [self.activitiesTableView_ dequeueReusableCellWithIdentifier:tableviewidentifier];
  
      if(cell==nil)
      {
          cell = [[tablecellTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:tableviewidentifier];
      }if(indexPath.row == [self tableView:tableView numberOfRowsInSection:indexPath.section] - 1){
          // [[cell textLabel] setText:@"Load more records"];
      }
  
      UILabel *valuedate = (UILabel *)[cell viewWithTag:21];
      UILabel *msg = (UILabel *)[cell viewWithTag:22];
      UILabel *date = (UILabel *)[cell viewWithTag:23];
      UILabel *time = (UILabel *)[cell viewWithTag:24];
     valuedate.text=[[self.inboxmessagesarray objectAtIndex:indexPath.row]objectForKey:@"messageId"];
      return cell;
  }
  </code></pre>