我有一个方法可以生成 aPFObject
并将其存储在NSMutableArray
. 然后一个 tableview 用这个数组填充自己。但是,存储 的方法PFObject
没有成功添加对象。这是方法:
- (void)addListing{
PFObject* userListing = [PFObject objectWithClassName:@"userListing"];
[userListing setObject:[NSString stringWithFormat:@"John Smith"] forKey:@"userName"];
[userListing setObject:[NSString stringWithFormat:@"408 521 3322"] forKey:@"userPhoneNumber"];
[userListing setObject:[NSString stringWithFormat:@"Lorem Ipsum Dolor Sit Amet"] forKey:@"listingName"];
[userListing setObject:[NSString stringWithFormat:@"$10"] forKey:@"listingPrice"];
[listings addObject:userListing];
[userListing saveInBackground];
NSLog(@"%i", listings.count);
}
在最后一行,我让控制台打印存储在列表中的对象数量,但它重复打印为零。我哪里错了?