I have a subclass of PFObject called PFGiveItem.
@interface PFGiveItem : PFObject <PFSubclassing>
+(NSString *)parseClassName;
@property (strong, nonatomic) NSString *giveItemName;
@property (strong, nonatomic) UIImage *giveItemImage;
@end
When I try to query for images I have saved to Parse, and then save the images to each of my GiveItems, I get an error. This is part of a larger loop which includes its own PFQuery; I'm just isolating this part to keep it simple because the rest of it works.
PFQuery *queryForRelatedImages = [PFQuery queryWithClassName:@"giveItemPhoto"];
[queryForRelatedImages whereKey:@"objectId" equalTo:@"pAwHU2e7aw"];
[queryForRelatedImages findObjectsInBackgroundWithBlock:^(NSArray *photos, NSError *error) {
PFFile *imageFile = photos[0][@"imageFile"];
NSLog(@"%@", imageFile);
[imageFile getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
if (!error){
newGiveItem.giveItemImage = [UIImage imageWithData:data];
}
}];
}];
When I run this code I get the error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'PFObject values may not have class: UIImage'
Which doesn't seem to make sense since the given property of the PFGiveItem class is in fact of the type UIImage.