Objective c NSArrayM objectAtIndex::索引2超出界限[0..1]';

Objective c NSArrayM objectAtIndex::索引2超出界限[0..1]';,objective-c,uitableview,nsmutablearray,parse-platform,pfquery,Objective C,Uitableview,Nsmutablearray,Parse Platform,Pfquery,所以我试图编辑我用PFQuery(parse.com)创建的数组。我需要检查它,然后从中删除对象,然后在UITableView中显示它,但当我运行它时,会出现此错误 - (PFQuery *)queryForParse { PFQuery *query1 = [PFQuery queryWithClassName:self.parseClassName]; //[query1 selectKeys: [NSArray arrayWithContentsOfFile:[ NSSt

所以我试图编辑我用PFQuery(parse.com)创建的数组。我需要检查它,然后从中删除对象,然后在UITableView中显示它,但当我运行它时,会出现此错误

- (PFQuery *)queryForParse
{
    PFQuery *query1 = [PFQuery queryWithClassName:self.parseClassName];

    //[query1 selectKeys: [NSArray arrayWithContentsOfFile:[ NSString @"checkMark"]]];

    [query1 whereKey:@"location" nearGeoPoint:[PFGeoPoint geoPointWithLatitude:[LocationController sharedSingleton].locationManager.location.coordinate.latitude longitude:[LocationController sharedSingleton].locationManager.location.coordinate.longitude] withinMiles:50];
    [query1 findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error){

            placesArray = [[NSMutableArray alloc] initWithArray:objects];
            NSMutableArray *toDelete = [NSMutableArray array];

            for (PFObject *tempObject in placesArray){
                if ([tempObject objectForKey:@"checkMark"] == nil){
                    [toDelete addObject:tempObject];
                }
            }
            [placesArray removeObjectsInArray:toDelete];
            NSLog(@"%@", placesArray);
        }
        [placesTable reloadData];
    }];
    return query1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    PlacesTableCell *cell = (PlacesTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil){
        cell = [[PlacesTableCell alloc] init];
    }

    PFObject *tempObject = [placesArray objectAtIndex:indexPath.row];
    cell.message.text = [tempObject objectForKey:@"message"];

    return cell;
}

听起来您可能只需要添加“
numberofrowsinssection:
”方法即可

例如:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // assuming only one section and one table here
    return([placesArray count]);
}

你的“
numberofrowsinssection:
”方法是什么样子的?我对Objective C非常陌生,所以我仍在努力解决所有问题。谢谢!我一直在为这件事焦头烂额,哈哈