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
TJ Rogers
8,758 PointsIt Works! Thank you! (Now, figuring out how to store my data)
I made my first app! And it actually works! ...on my phone!
Seriously, this is like magic to me. Before a few weeks ago, I had never even even laid eyes on a line of code, aside from the odd bit of HTML (about all I know is that b /b will bold your text ) . Somehow I got it into my head that it might be fun and cool to learn how to code apps. And now I get to click on an icon on my own phone and play with an app that I made. Sweet!
Thanks to Team Treehouse and everyone on this forum who jumped in when I got stuck (which happened more than a few times).
My app is pretty much a glorified database. It contains election results for all the local elections in my county for this year, which is a pretty big chunk data. In an excel file it was 1,700 rows and 8 columns. The app allows the user to segue through several tables to find election results a lot quicker than the canvass results on the county website. I will be expanding it beyond this basic functionality, but I just wanted to see if I had the skills to do even that much (yay!).
So now that I got his thing working, I need to go back to the beginning. Right at the start, I couldn't figure out how to convert my Excel data into something usable that I could pass around in an NSArray. So I posted to the forum, and one of you suggested that I use Parse to upload as a CSV and get my results that way.
Getting the data through Parse works, and thank you to Stone Preston for suggesting this, because it allowed me to get off the ground and start programming. But the problem is that it's slow. At the app's loading point, I need to retrieve all the data from Parse - all 1,700 rows of data. This takes upwards of 10 seconds to complete. so clearly Parse isn't the way to go - even the peeps on the Parse forum suggested that using Parse for this isn't the best solution. Furthermore I plan to add the results for 20 previous years as well, so using Parse, loading the app would take 20 times as long (200 seconds... yeesh!).
From poking around a bit, it seems like what I need to do is convert my Excel data into SQLite and then access it using core data. This way the data never needs to be retrieved from a 3rd party, and loading will be nearly instant.
Can anyone direct me to a resource where I can learn how to do this? Or is there another method that you would recommend?
Thanks again everyone!
1 Answer
Ben Jakuben
Treehouse TeacherThat's awesome, TJ! I'd suggest starting with Amit's own videos on Core Data in iOS Foundations. Using core data is the way to go for storing and accessing a large amount of data like that.
Will the data ever need to be updated? Ideally you could add a refresh option that allows users to pull down new data from Parse or somewhere else. If it's a ton of data, perhaps you can compress it and download it in one big chunk and then uncompress in your app and load it into Core Data.