在从异步Parse查询中检索结果之前,我的OS X CLI程序退出。在iOS应用程序中不会发生相同的代码(因为iOS应用程序有GUI?)。有没有办法处理结果,而程序不会过早退出?
#import "Bolts.h"
#import <Parse/Parse.h>
int main(int argc, const char * argv[])
{
@autoreleasepool
{
[Parse setApplicationId:@"my parse app id"
clientKey:@"my parse app client key"];
PFQuery *query = [PFQuery queryWithClassName:@"Wizard"];
[query whereKey:@"house" equalTo:@"Hufflepuff"]
[[query findObjectsInBackground] continueWithBlock:^id(BFTask *task)
{
for (PFObject *wizard in task.result)
{
// does not go here, program exits immidiately
// ??
}
}
}
return 0;
}