Question

I am using parse services as a backend. I am facing one problem to create the one functionality in parse i.e any user can able to post the image and any body can able to like that post. I created a table for the posting of image and i created a second table who liked the post details. Now,my problem is how to get the details of the Post image details with like status ,Liked members details .I need all details at a time itself.So i can reduce the loading and increase the speed of application.How to create a relation between two table by satisfying my condition.I am waiting for your valuable answers.

Was it helpful?

Solution

Create a table for activities. In your case, you only have 1 activity: liking. But that may expand later on, so you should have a table that can keep track of all activities (like comments, adding tags etc).

When you fetch an image, you query the activity table for all activities related to that image. In a table view of images, you can set off a background thread for collecting activities, and then update the table view rows when activities are downloaded.

You should create a local cache for all activities, so that you only fetch them from backend if they don't exist in the cache.

The best way to learn how to do this is to read the parse.com tutorial for the AnyPic app: https://parse.com/tutorials/anypic

Download the code and read the tutorial . I used the same principals, and quite a lot of the code, for my own app, and it handles this exact challenge nicely.

Good luck :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top