解析sdk在调用查询api时崩溃

时间:2014-07-08 13:30:30

标签: ios macos parse-platform

我只是尝试使用解析后端编写一些示例应用程序,我创建了应用程序和测试类,它适用于ios,对于相同的调用,如果我进行PFquery调用以检索它在mac上崩溃的对象。

    PFQuery *query = [PFQuery queryWithClassName:@"stock"];

    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (query.cachePolicy != kPFCachePolicyCacheOnly && error.code == kPFErrorCacheMiss) {
            // No-op on cache miss - since the policy is not CacheOnly, this
            // block will be called again upon receiving results from the network.
            return;
        }}];

1 个答案:

答案 0 :(得分:1)

您设置的cachePolicy错误。

使用此:

 PFQuery *query = [PFQuery queryWithClassName:@"stock"];
                    [query setCachePolicy:kPFCachePolicyNetworkOnly];
                    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
                        if (!error) {

                           }
                    }];