0

そのため、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;
}
4

1 に答える 1

0

numberOfRowsInSection:その " " メソッドを追加するだけでよいようです。

例えば:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // assuming only one section and one table here
    return([placesArray count]);
}
于 2013-09-17T07:05:54.957 に答える