ShivaPrasad
ShivaPrasad

Reputation: 926

Parse sdk crashes on calling query api

I just try to write some sample app using parse backend, i created app and test class, its worked fine for ios, for same calls if i make a PFquery call to retrive objects its crashing on 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;
        }}];

Upvotes: 0

Views: 177

Answers (1)

Marcus Ataide
Marcus Ataide

Reputation: 7530

You are setting cachePolicy wrong.

Use this:

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

                           }
                    }];

Upvotes: 1

Related Questions