Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

how often should I grab data from parse?

In the ribbit project we grabbed messages every time the view appeared. In terms of api requests this could add up to a lot of requests. Is this the norm? or should I grab data once the first time a view appears and only grab it if the user refreshes? Im curious as to what the industry norm is. Naturally grabbing it every time the view appears has its advantages and disadvantages, as does only when the user wants it etc. Ben Jakuben

1 Answer

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Depends on what the API request is doing on the server side. If each time you are requesting a list of new messages then it is querying the entire messages database then that is a lot of overhead.

Ideally, you want to update only when there are new messages. So you could have a separate table that tracks new messages and check it quickly. If there is a new message then you initiate a query to grab the latest messages.

With iOS 7 you also have background fetch and remote notifications. You can read more about it here: http://www.objc.io/issue-5/multitasking.html