我可以使用一些帮助进行故障排除。我使用Parse.com,并执行查询以从其中一个Parse类返回所有对象。当视图出现时使用下面的代码我这样做。当我运行它时,控制台日志显示有8个对象,所以我希望代码运行8次,每个对象一个。但是,它只运行3次。我错过了什么?
-(void) viewWillAppear:(BOOL)animated {
PFQuery *query = [PFQuery queryWithClassName:@"Share"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
NSLog(@"Objects%lu", (unsigned long)[objects count]);
for (int i=0;i<[objects count];i++)
{
PFObject * obj = [objects objectAtIndex:i];
self.theObject = obj;
//Continue running code for each of the items in PFObject
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
}