简体   繁体   中英

Parse Class Run Through For Loop

My app uses Parse.com for most of its services. The main screen has a PFTableViewController, showing all the objects of a certain class. I would like to add all of these as NSUserActivity, so I know I need to run it through a for loop, but for the life of me, can't think of how to run the class through the loop to add each item from the class into a NSUserActivity.

What I have so far before setting up the table.

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

        // The className to query on
        self.parseClassName = @"Prayers";

        // 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 = 20;

    }
    return self;
}
- (PFQuery *)queryForTable {
    NSLog(@"QUERY");
    PFQuery *query = [PFQuery queryWithClassName:@"Prayers"];

    // If no objects are loaded in memory, we look to the cache first to fill the table
    // and then subsequently do a query against the network.
    if (self.objects.count == 0) {
        query.cachePolicy = kPFCachePolicyCacheThenNetwork;
    }

    [query orderByDescending:@"createdAt"];


    return query;
}

There seems to be no real API for this... Please refer to this link for a possible workaround:

https://parse.com/questions/all-keys-or-method-or-query-to-determine-common-class-structure-of-all-objects-in-a-class-collection

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM