当我尝试从iOS中的本地数据存储中获取记录时,对象正在返回但是如果我访问自定义属性则会出现错误" - [PFObject name]:无法识别的选择器发送到实例&# 34; 即可。以下是示例代码段。
PFQuery *query = [PFQuery queryWithClassName:@"GameScore"];
[query fromPinWithName:@"MyChanges"];
[[query findInBackground] continueWithBlock:^id(BFTask *task) {
NSArray *scores = task.result;
for (GameScore *score in scores) {
NSLog(@"score is : %d %d", score.highScore, score.name);
}
}];
我的子类就像
@interface GameScore : PFObject <PFSubclassing>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSNumber *highScore;
@end
我将它们保存为
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
[GameScore pinAllInBackground:objects withName:@"MyChanges" block:^(BOOL succeeded, NSError *error) {
}];
}];
答案 0 :(得分:0)
我和你有完全相同的问题,问过&amp;在这个问题中回答:Parse local datastore and PFObject subclasses
在使用Parse框架执行任何其他操作之前,只需确保注册子类。