我正在使用解析,并试图在我的tableview的字幕中显示PFUser Name。 当我尝试显示在下面的代码中时,它使我的程序崩溃。

保存PFObject:

    PFUser *user = [PFUser currentUser];

    PFObject *quoteNew = [PFObject objectWithClassName:@"New"];
    [quoteNew setObject:user forKey:@"user"];
    [quoteNew setObject:[[self quoteText] text] forKey:@"Text"];

查询用户:

-(id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        // Customize the table

        // The className to query on
        self.parseClassName = @"New";
       // self.className2 = @"Story";

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

        self.User = @"user";
       // self.textKey2 = @"title";

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

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

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

尝试显示用户:

   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
    // If you want a custom cell, create a new subclass of PFTableViewCell, set the cell identifier in IB, then change this string to match
    // You can access any IBOutlets declared in the .h file from here and set the values accordingly
    // "Cell" is the default cell identifier in a new Master-Detail Project
    static NSString *CellIdentifier = @"Cell";

    PFTableViewCell *cell = (PFTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[PFTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    // Configure the cell
    cell.textLabel.text = [object objectForKey:self.textKey];
    cell.detailTextLabel.text = [object objectForKey:self.User];

    //cell.imageView.file = [object objectForKey:self.imageKey];

    return cell;
}

  ask by user3546542 translate from so

本文未有回复,本站智能推荐: