0
我已經看過所有在互聯網上,並沒有發現任何東西,請幫助我。我試圖弄清楚如何在解析表中顯示用戶名(detailTextLabel
)。當我執行下面的代碼時,我的應用程序只顯示PFUser Id
而不是用戶名。它將顯示:<PFUser:H2AhEbYGal:(null)> {
但我試圖顯示該帖子的用戶名。顯示用戶名 - 解析
繼承人我保存對象:
PFUser *user = [PFUser currentUser];
PFObject *quoteNew = [PFObject objectWithClassName:@"New"];
quoteNew[@"author"] = user;
[quoteNew setObject:[[self quoteText] text] forKey:@"quoteText"];
下面是我試圖找回在PFQuery
用戶:
PFQuery *query = [PFQuery queryWithClassName:@"New"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// The find succeeded. The first 100 objects are available in objects'
[query includeKey:@"author"];
// PFObject *testObject = [query findObjects];
// PFUser *testUser = [testObject objectForKey:@"author"];
// NSLog(@"username: %@",testUser.username);
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
下面是我試圖顯示它:
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@: %@",[object objectForKey:@"author"],[dateFormat stringFromDate:updated]];
您只需要擔心[object objectForKey:@"author"]
那cell.detailTextLabel.text
代碼。
你能幫助我嗎?請! @rmaddy – user2977529
repleace this quoteNew [@「author」] = user;用quoteNew [@「author」] = user.username; – Pawan
現在當我這樣做時,整個帖子將不會在tableview中顯示@pawan – user2977529