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 Build a Photo Browser iPhone App Connecting to an API using OAuth Caching Photos

kennedy otis
kennedy otis
3,570 Points

Save to core data

Hi Is it possible to persist the json data downloaded to core data instead of caching. I would like to do this so that the content can be accessed offline too. Any tutorial link or tip on how to achieve this.

2 Answers

Sam Soffes
STAFF
Sam Soffes
Treehouse Guest Teacher

Kennedy,

Great suggestion. In practice, I usually use Core Data. We decided to use a simpler approach for this course because we wanted to show lots of fun UI things. Explaining Core Data would have taken a lot of time and not let us do as many visual things. Amit and I definitely want to do a Core Data class at some point in the future.

If you decide to go about this on your own, I'd store all of the photo's relevant metadata in Core Data and save the photos on disk with SAMCache. Saving images in Core Data isn't ideal. I use SSDataKit in all of my apps to help with Core Data.

Core Data is a bit hard to get started with. I suggest reading the guides in the documentation or watching the videos on Core Data from WWDC.

kennedy otis
kennedy otis
3,570 Points

Thanks Sam.. I will take a look at it.. Will be nice to store them n read from core data and not download them..and incase of new content then I simply add it to core data.. By any chance do you have an open source I learn from it while waiting for another yummy course like the one you did :)