I am creating a social networking app in iOS for a university group and it's supposed to have display user feeds just like Facebook.
I am saving status updates in MySql database on a server. to update status I am using NSURLRequest and NSURLSession to send status data in post variables to the status update web service which uses php to update the database.
Now, I am confused about displaying the feeds. Here is what i want to do.
I know how to make the first request and display 30 feeds, but I dont know how to do it the second time. Do I need to make another request? Can someone please explain how Facebook and Twitter do it?
Your request needs to ask for a specific page or offset of the feed, and your server should handle this.
For the first feed, you'd ask for page 0. The server gives you items 1 - 30. At the app end, you keep track of the page you last requested. On the next request, you ask for page 1, and the server gives you items 31-60.
Alternatively, you can send the ID of the last item you have. So for the first request, you send nothing - the server gives you items 1-30. On the second request, you say "the last item in my current list is ID 14152" and the server gives you the next 30 items older than that.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments