iOS의 로컬 데이터 저장소에서 레코드를 가져 오려고하면 개체가 반환되지만 사용자 지정 속성에 액세스하면 "-[PFObject name] : unrecognized selector sent to instance" 오류가 발생 합니다. 다음은 샘플 코드 스 니펫입니다.
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) {
}];
}];
나는 당신과 똑같은 문제가 있었고이 질문에서 묻고 대답했습니다 : Parse local datastore 및 PFObject 하위 클래스
Parse 프레임 워크로 다른 작업을 수행하기 전에 하위 클래스를 등록했는지 확인하기 만하면됩니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다