Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Uitableview 解析tableview和指针_Uitableview_Parse Platform - Fatal编程技术网

Uitableview 解析tableview和指针

Uitableview 解析tableview和指针,uitableview,parse-platform,Uitableview,Parse Platform,我正在尝试使用与当前用户相关的“创建人”对象填充tableview中的cell.textable.text。我得到的是对所有用户的教训 以下是我所拥有的: - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithClassName:@"Lessons"]; self = [super initWithCoder:aDecoder]; if (self) { // The cla

我正在尝试使用与当前用户相关的“创建人”对象填充tableview中的cell.textable.text。我得到的是对所有用户的教训

以下是我所拥有的:

    - (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithClassName:@"Lessons"];
    self = [super initWithCoder:aDecoder];
    if (self) {
        // The className to query on
        self.parseClassName = @"Lessons";

        // The key of the PFObject to display in the label of the default cell style
        self.keyToDisplay = @"Player";

        // Whether the built-in pull-to-refresh is enabled
        self.pullToRefreshEnabled = YES;

        // Whether the built-in pagination is enabled
        self.paginationEnabled = NO;

        // The number of objects to show per page
        self.objectsPerPage = self.Lessons.count;
    }
    return self;
}

- (PFQuery *)queryForTable {
    PFQuery *query = [PFQuery queryWithClassName:@"Lessons"];
    [query includeKey:@"Player"];
    [query includeKey:@"name"];
    [query includeKey:@"updatedAt"];
    [query includeKey:@"createdBy"];

    // If no objects are loaded in memory, we look to the cache first to fill the table
    // and then subsequently do a query against the network.
    if (self.objects.count == 0) {
        query.cachePolicy = kPFCachePolicyCacheThenNetwork;
    }


    [query orderByDescending:@"createdAt"];

    return query;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
                        object:(PFObject *)object
{
    static NSString *cellIdentifier = @"Lessoncell";

    PFTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[PFTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                      reuseIdentifier:cellIdentifier];
    }
这里我需要放置与当前用户相关的所有播放器,而不仅仅是每个用户创建的所有播放器

    PFObject *player = object[@"Player"];

    NSLog(@"%@", player);

    [player fetchIfNeededInBackgroundWithBlock:^(PFObject *player, NSError *error) {


        cell.textLabel.text = player[@"name"];

        NSDate *updated = [object updatedAt];
        NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
        [dateFormat setDateFormat:@"EEE, MMM d, h:mm a"];
        cell.detailTextLabel.text = [NSString stringWithFormat:@"Lesson Taken: %@", [dateFormat stringFromDate:updated]];

    }];


    return cell;
}

但真正的问题是什么?什么不起作用了?所以我有一个俱乐部的
用户
类和该俱乐部的
球员
类。我试图返回与用户相关的所有球员,而不是所有俱乐部的所有球员,这就是它现在所做的。也许很简单,但我的大脑在流血。