Проблема, как представляется, ссылка на следующих колонке Followers
вместо последователем. Посмотрите внимательно на два запроса ниже:
// Query for the friends the current user is following
let followingActivitiesQuery = PFQuery(className: "Followers")
followingActivitiesQuery.whereKey("following", 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
let photosFromFollowedUsersQuery = PFQuery(className: "Object")
photosFromFollowedUsersQuery.whereKey("userId", matchesKey: "following", inQuery: followingActivitiesQuery)
photosFromFollowedUsersQuery.whereKeyExists("image")
В частности, эта строка:
followingActivitiesQuery.whereKey("following", equalTo: PFUser.currentUser()!)
В первом запросе, цель состоит в том, чтобы получить все, что пользователь следующий. Это означает, что нужно запросить все объекты Followers
, где последователь указывает на текущего пользователя. Во втором запросе мы сопоставляем после столбец из первого запроса.
Первый запрос должен быть:
followingActivitiesQuery.whereKey("follower", equalTo: PFUser.currentUser()!)