解析类贯穿循环

时间:2015-09-29 03:36:41

标签: ios for-loop parse-platform pfobject

我的应用程序使用Parse.com进行大部分服务。主屏幕有一个PFTableViewController,显示某个类的所有对象。我想将所有这些添加为NSUserActivity,所以我知道我需要通过for循环运行它,但对于我的生活,我们不能想到如何通过循环运行类来添加每个项目从班级变成NSUserActivity。

在设置表格之前我到目前为止所做的事情。

- (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;
}

1 个答案:

答案 0 :(得分:1)