CKQuery の仕組みについて基本的な誤解があります。
私は2つのレコードタイプを持っています:
- Friends : フィールドを含む
- url_of_profile_pic
- 名前
- ...
- 投票: フィールドを含む
- date_of_vote
- target_of_the_vote (フレンド CKReference)
- the_one_who_vote (クラウドキット ユーザー ID)
Voteテーブルをクエリしているときにurl_of_profil_picを取得する方法をさまよっています
基本的に、次のようなものが欲しかった:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"the_one_who_vote = %@", recordReference.recordID];
CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Votes" predicate:predicate];
query.sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc]initWithKey:@"createdAt" ascending:false]];
CKQueryOperation *operation = [[[CKQueryOperation alloc] initWithQuery:query] autorelease];
operation.desiredKeys = @[@"target_of_the_vote . url_of_profil_pic"];
operation.resultsLimit = 10;
operation.recordFetchedBlock = ^(CKRecord * _Nonnull record)
この行は、URL を提供する述語になります。
operation.desiredKeys = @[@"target_of_the_vote . url_of_profil_pic"];