我们在_User表中存储了m属性和n属性,然后需要检索出所有m属性的对象,然后精准给他们发送Push,但是Push里要含有n属性字段,我们这样设计,但是感觉不对劲:
AVQuery *userQuery = [AVQuery queryWithClassName:kLeanCloudPlayersObject];
[userQuery whereKey:kLeanCloudPlayers_Competition_Key equalTo:[NSString stringWithUTF8String:m]];
[userQuery getFirstObjectInBackgroundWithBlock:^(AVObject *competitionObject, NSError *error) {
if (!error) {
int n = [[competitionObject objectForKey:kLeanCloudPlayers_RankNumber_Key] intValue];
AVQuery *pushQuery = [AVInstallation query];
[pushQuery whereKey:@"owner" matchesQuery:userQuery];
AVPush *push = [[AVPush alloc] init];
[push setQuery:pushQuery]; // Set our Installation query
[push setMessage:(m+n组成的字段)];
[push sendPushInBackground];
主要因为这句 [pushQuery whereKey:@"owner" matchesQuery:userQuery];
感觉之前为了检索出符合条件的object,已经做了一次Query,这里好像又重复做了一次query,是不是很没有效率,如果按照这个需求,应该怎么写最好呢?