Reputation: 3862
Of all the columns in a class, There are two columns which stores Images. column1 and column2 stores images.
Now, the thing I am trying to achieve is to get image from either of those columns. i.e get all columns except column 1 or get all columns except column 2. So, as to avoid downloading other image column data, which is not useful and so as to reduce network usage.
Here is the code which i tried. I am not able to find whether its possible to achieve this or not.
PFQuery *query=[PFQuery queryWithClassName:@"MyUsers"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
for(NSDictionary *dic in objects){
//I want either of image in column "column1" & "column2"
PFFile *file=[dic objectForKey:@"column1"];
PFFile *file2=[dic objectForKey:@"column2"];
self.imgV.image=[UIImage imageWithData:[file getData]];
}
}];
Upvotes: 1
Views: 371
Reputation: 9252
The results provided by a PFQuery do not include the actual PFFile's contents, but rather a pointer to the file itself. You can selectively download either PFFile by calling any of its getData methods. Once the file has been downloaded once, it will then be cached locally to disk.
Upvotes: 2