我正在阅读Parse anypic 教程并且来自Android背景我很难理解Android等效于此Parse查询。我已经尝试了几个小时,谷歌搜索了很多但没有用。这是关于在时间线上显示朋友的帖子。
- (PFQuery *)queryForTable {
// Query for the friends the current user is following
PFQuery *followingActivitiesQuery = [PFQuery queryWithClassName:kPAPActivityClassKey];
[followingActivitiesQuery whereKey:kPAPActivityTypeKey equalTo:kPAPActivityTypeFollow];
[followingActivitiesQuery whereKey:kPAPActivityFromUserKey equalTo:[PFUser currentUser]];
// Using the activities from the query above, we find all of the photos taken by
// the friends the current user is following
PFQuery *photosFromFollowedUsersQuery = [PFQuery queryWithClassName:self.className];
[photosFromFollowedUsersQuery whereKey:kPAPPhotoUserKey matchesKey:kPAPActivityToUserKey inQuery:followingActivitiesQuery];
[photosFromFollowedUsersQuery whereKeyExists:kPAPPhotoPictureKey];
// We create a second query for the current user's photos
PFQuery *photosFromCurrentUserQuery = [PFQuery queryWithClassName:self.className];
[photosFromCurrentUserQuery whereKey:kPAPPhotoUserKey equalTo:[PFUser currentUser]];
[photosFromCurrentUserQuery whereKeyExists:kPAPPhotoPictureKey];
// We create a final compound query that will find all of the photos that were
// taken by the user's friends or by the user
PFQuery *query = [PFQuery orQueryWithSubqueries:[NSArray arrayWithObjects:photosFromFollowedUsersQuery, photosFromCurrentUserQuery, nil]];
[query includeKey:kPAPPhotoUserKey];
[query orderByDescending:@"createdAt"];
. . .
return query;
}
我只想要这行的android等价物:
[photosFromFollowedUsersQuery whereKey:kPAPPhotoUserKey matchesKey:kPAPActivityToUserKey inQuery:followingActivitiesQuery];
我查看了Parse文档和AnyPic项目的快速等价物,但没有用。
答案 0 :(得分:0)
我自己想出来了。以下是等效的
<强>的iOS 强>
www.ipnurl.com
<强>的Android 强>
[photosFromFollowedUsersQuery whereKey:kPAPPhotoUserKey matchesKey:kPAPActivityToUserKey inQuery:followingActivitiesQuery];