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 trialMike Bentley
1,588 PointsInserting data in core data from JSON in background.
Can anyone help me get started on this, I have the example Diary app working, what I want to do is populate the core data stack using a JSON request in the background, similar to the examples in the Blog Reader or the background requests in the Rabit examples without using parse.com.
Im guessing, a new object class, call in on list didload to go in background an download the data, ( not sure how ) then 'sync' or just overwrite the exising list in core data.
I have seen lists can us xml, is it easier to just download an xml file and cache is somehow instead of using core data?
2 Answers
Alex Cevallos
16,551 PointsHey mike, are you asking how to store JSON within core data?
Mike Bentley
1,588 PointsI guess so, I have the diary app reading and writing to core data. But I want to get the date from a JSON Request so need to do the JSON Request then convert to a Dictionary then to core data. ( I think ).
Basically I want the app to work offline, and be fast so I need to load the JSON Data in the background. I have the Blog Post app reading the JSON Data directly but it takes time to open while it gets the data.
I guess Im Looking for an easy way to convert the Dictionary that I made from the JSON to core data.
Erion Vlada
13,496 PointsLook up Cocoapods online. There are multiple pod (API’s) that have been made by other people which you can use for free. Alternatively, watch these Stanford lecture, it is much more in depth than these videos for core data and should get you up and running quickly. Lecture 12 - (https://www.youtube.com/watch?v=2Z5-2tZrbPM), also watch lecture 13 - (https://www.youtube.com/watch?v=N2sZ9IjDBzs)
Hope this helps.