Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.