【发布时间】:2014-07-25 23:50:09
【问题描述】:
我有一个名为 PFGiveItem 的 PFObject 子类。
@interface PFGiveItem : PFObject <PFSubclassing>
+(NSString *)parseClassName;
@property (strong, nonatomic) NSString *giveItemName;
@property (strong, nonatomic) UIImage *giveItemImage;
@end
当我尝试查询已保存到 Parse 的图像,然后将图像保存到我的每个 GiveItems 时,我收到错误消息。这是一个更大的循环的一部分,其中包括它自己的 PFQuery;我只是隔离这部分以使其简单,因为它的其余部分有效。
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];
}
}];
}];
当我运行这段代码时,我得到了错误
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'PFObject values may not have class: UIImage'
这似乎没有意义,因为 PFGiveItem 类的给定属性实际上是 UIImage 类型。
【问题讨论】:
标签: ios iphone cocoa-touch uiimage parse-platform