title: Obj-C: Error __NSSingleObjectArrayI removeObjectAtIndex:]: unrecognized selector sent to instance?
body: <p>I'm trying to remove an array from my NSDictionary (deleting an object from my tableview) with the code below, however for some reason I get a crash at this line:</p>
  
  <blockquote>
    <p>[self.friendData removeObjectAtIndex:indexPath.row];</p>
  </blockquote>
  
  <p>with this error:</p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception
    'NSInvalidArgumentException', reason: '-[__NSSingleObjectArrayI
    removeObjectAtIndex:]: unrecognized selector sent to instance
    0x1c0618e20'</p>
  </blockquote>
  
  <p>Any idea why this is and what the fix would be? See console info for self.friendData and code below: </p>
  
  <p><strong>ViewController.h</strong></p>
  
  <pre><code>@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentControl;
  @property (weak, nonatomic) IBOutlet UITableView *sidetableView;
  @property (strong, nonatomic) NSMutableArray *myFriendData;
  @property (weak, nonatomic) IBOutlet UITableView *neighboursView;
  @property (strong, nonatomic) NSMutableArray *friendData;
  @property (strong, nonatomic) NSMutableArray *neighbourData;
  
  @property (strong, nonatomic) IBOutlet UITableView *friendsView;
  </code></pre>
  
  <p><strong>ViewController.m</strong></p>
  
  <pre><code>- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
      if (tableView == self.sidetableView) {
          return UITableViewCellEditingStyleDelete;
      }
  
      if (tableView == self.friendsView) {
          return UITableViewCellEditingStyleDelete;
      }
  
      else {
          return UITableViewCellEditingStyleNone;
      }
  }
  
  - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      if (editingStyle == UITableViewCellEditingStyleDelete) {
  
          if (tableView == self.friendsView) {
  
              NSMutableDictionary *nodeData = [[self.friendData objectAtIndex:indexPath.row] mutableCopy];
  
              NSString *nid = [nodeData objectForKey:@"nid"];
              [nodeData setObject:nid forKey:@"nid"];
  
  
              [self.friendData removeObjectAtIndex:indexPath.row];
  
              [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
  
  
  
              [DIOSNode nodeDelete:nodeData success:^(AFHTTPRequestOperation *operation, id responseObject) {
                  NSLog(@"node deleted!");
              } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                  NSLog(@"could not delete node!");
              }];
  
  
          } else {
  
          NSMutableDictionary *nodeData = [[self.myFriendData objectAtIndex:indexPath.row] mutableCopy];
  
          NSString *nid = [nodeData objectForKey:@"nid"];
          [nodeData setObject:nid forKey:@"nid"];
          NSLog(@"%@",nid);
  
          [self.myFriendData removeObjectAtIndex:indexPath.row];
  
          [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
  
  
  
          [DIOSNode nodeDelete:nodeData success:^(AFHTTPRequestOperation *operation, id responseObject) {
              NSLog(@"node deleted!");
          } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
              NSLog(@"could not delete node!");
          }];
  
  
  
          }
  
      }
      }
  </code></pre>
  
  <p>Console self.friendData:</p>
  
  <pre><code>This is the frienddata (
          {
          address2 = "street";
          body = "nfkkdkckmfkekxkx\n";
          childrenunder = No;
          city = "&lt;null&gt;";
          "emergency facility" = Yes;
          friendphoto = "files/stored/1504910599.jpg";
          nid = 1796;
          "node_title" = "josh";
          phone = 2369893091;
          "postal code" = V;
          "property type" = House;
          "special skills" = "med";
          "star rating" = 1;
          supervision = No;
          uid = 47;
          uid2 = 182;
      }
  </code></pre>