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

Is it possible to use database without some service like parse.com ?

All the classes we end up using some service like parse.com but nobody ever talks about using local databases. Is it possible? How it's done?

2 Answers

Susanna Remec
Susanna Remec
12,316 Points

Hi Fernando, Yes local data bases are very possible given that your data is a smallish set. You can load a JSON or XML file with the app bundle and access it with the appropriate parser. Just point the parser at your onboard file instead of a URL. Another way is to use Core Data- i think Apple prefers this method and it is capable of much more complex data retrieval. Core Data is a bit harder to wrap your brain around at first but it is worth the effort to learn. There is a video or two on Treehouse that cover the basics. Good Luck!

Patrick Cooney
Patrick Cooney
12,216 Points

There are also several database options available for the iPhone. You can use sqlite3 without needing Core Data. There are several wrappers out there to make using sqlite3 easier and to prevent you from having to write raw SQL. You can find a lot of them on github. There is also a notable new database called Realm that you can check out. They have both an Objective-C and Swift version.