title: Assertion failure in UITableView _endCellAnimationsWithContext
body: <p>i have a problem like this :</p>
  
  <p>i am loading some data to a table view after select a date from a date picker.the data which i want to load is loaded to a variable inside the didSelectRowAtIndexPath method. when the table is checking for the number of rows it checks the count of that variable is grater than zero and so on..</p>
  
  <p>my problem is this : when i load the data to the variable by calling a web service [using AFNetworking library] it is works nicely. but when i get the data directly [i have implemented a method to call web service before the table load, and holds the data] by a method it is giving this error </p>
  
  <pre><code>   Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:1330                                       
  </code></pre>
  
  <p>2014-05-02 17:25:12.665 varrdle_v2[1428:a0b] <strong>* Terminating app due to uncaught exception<br>
  NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (3) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).
  *</strong> First throw call stack:</p>
  
  <p>i cant figure out why that happens. the only different is the way i taken the data.</p>
  
  <p>below is my implementation</p>
  
  <p><strong>number of rows</strong></p>
  
  <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
   {
  
  
  NSArray* reqFdate= [TableViewController getrequestPerDate];
  NSLog(@"Count OF REQUESTS: %d",reqFdate.count);
  if (reqFdate.count == 0 ) {
      NSInteger numberOfRows = [self.persons count];
  
      if ([self datePickerIsShown]){
  
          numberOfRows++;
  
      }
      NSLog(@"NO OF ROWS in IF %d",numberOfRows);
      return numberOfRows;
  }
  else{
      NSLog(@"NO OF ROWS %d",reqFdate.count);
      return reqFdate.count;
  }
     }
  </code></pre>
  
  <p><strong>cell for row at indexpath</strong></p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
  
  UITableViewCell *cell;
  
  NSDate *today = [NSDate date];
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  // display in 12HR/24HR (i.e. 11:25PM or 23:25) format according to User Settings
  [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
  NSString *currentTime = [dateFormatter stringFromDate:today];
  NSDate *date=[dateFormatter dateFromString:currentTime];
  
  
  
  if(indexPath.row==0){
      VCPerson *person = self.persons[0];
  
      cell = [self createPersonCell:person];
  
  }
  
  
  
  else if ([self datePickerIsShown] &amp;&amp; (self.datePickerIndexPath.row == 1)){
  
      // VCPerson *person = self.persons[indexPath.row -1];
  
  
  
      cell = [self createPickerCell:date];
  
  }
  
  else{
  
      TacleCell *cell = (TacleCell*)[self.tableView dequeueReusableCellWithIdentifier:otherCellID];
      cell.delegate = self;
  
  
      if(cell == nil)
      {
          cell = [[TacleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:otherCellID];
      }
  
  
      else
      {
          //cancel loading previous image for cell
          [[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:cell.profileImage];
      }
  
  
  
      return cell;
  }
  
  return cell;
  
  }
  </code></pre>
  
  <p><strong>didSelect method</strong></p>
  
  <pre><code>-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  
  
      [self.tableView beginUpdates];
  
      int countOfRowss = [TableViewController getrequestPerDate].count;
      if(countOfRowss&gt;0)
      {
      NSArray* indexpathsArry = [self getIndexPaths];
  
      [self.tableView deleteRowsAtIndexPaths:indexpathsArry withRowAnimation:YES];
      requestForDate = nil;
  
      }
  
      if ([self datePickerIsShown] &amp;&amp; (self.datePickerIndexPath.row - 1 == indexPath.row)){
  
          [self hideExistingPicker];
          //[self.tableView reloadData];
          //[self viewDidLoad];
  
          //call the service and take the results
  
  
  
          NSString* selecteDate = [TableViewController getDate];
  
          //NSString* prsonID =[LoginView getPersonID];
  
  
         //  here i call this method and get the data.
          requestForDate= [self filterRequestForDate:selecteDate];
          NSLog(@"FILTERED REQUESTS :%@",requestForDate);
  
          //requestForDate = nil;
          [self.tableView reloadData];
  
  
  
  
  
         // NSString* selecteDate = [ScheduleView getDate];
  
  
  
      //  this is how i fetch the data by using a web service
         /* NSString* prsonID =[LoginView getPersonID];
  
          NSDictionary* parms = [NSDictionary dictionaryWithObjectsAndKeys:prsonID,@"caregiverPersonId",selecteDate,@"selectedDate", nil];
  
          jsonpaser* jp = [[jsonpaser alloc]init];
          //[self.indicator_process startAnimating];
          [jp getWebServiceResponce:@"myUrl" :parms success:^(NSDictionary *responseObject)
           {
  
  
  
               requestForDate = responseObject;
               NSLog(@"RESPONSEFORDATE_IN DIDSELECT :%@",requestForDate);
               NSArray* indexpaths = [self getIndexPaths];
               NSLog(@"indexPATHS %@",indexpaths);
               //[self.indicator_process stopAnimating];
               //[_dimmingView removeFromSuperview];
               [self.tableView reloadData];
  
           }];
  
          */
  
          }
  
      else{
  
          //--
  
          NSIndexPath *newPickerIndexPath = [self calculateIndexPathForNewPicker:indexPath];
  
          if ([self datePickerIsShown]){
  
              [self hideExistingPicker];
  
  
          }
  
          [self showNewPickerAtIndex:newPickerIndexPath];
  
  
  
          self.datePickerIndexPath = [NSIndexPath indexPathForRow:newPickerIndexPath.row + 1 inSection:0];
          NSLog(@"DATEPICKERINDEX %@",self.datePickerIndexPath);
  
  
          //self.datePickerIndexPath = nil;
  
  
  
      }
  
      // this is the line where a row deleted
      [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
  
      [self.tableView endUpdates];
  
  
   }
  </code></pre>
  
  <p>please someone tell me where is the issue...</p>
  
  <p>thank you </p>