Reputation: 173
I am trying to display the profile picture of the author for each post in the tableview using Swift and Parse.
The view controller at hand is querying one class (Post class) from Parse to obtain all the contents of a post. However, only one of the contents of a post (the profile picture which is of type File in Parse) is stored in another class, the User class, because each user has a profile picture.
Each post in the Post class has a foreign key (to represent the author of the post) which points to the User class.
How can I access the photo column from the User class from a pointer in the Post class?
Upvotes: 0
Views: 78
Reputation: 119031
The reference from the post to a user should be a pointer. Then, the query can specify to includeKey
with the name of that pointer to have the user included in the results of the query so you can access its details.
The above requires public read permissions on all users. If you want better data security you need to do the above in cloud code and return only the required data.
Upvotes: 1