Database in iOS App

Hi,

I'm trying to develop an iOS app but I'm not sure of what's the best option to store and manage data.

My starting point is a MySQL database; I've already written the code to access my database (using PHP) and perform some analysis on the stored data. E.g., I've tables to store user infos, for bank transactions, and so on; I can see the list of the transactions for a single user, categorize the transactions, ecc.

This works well for a browser but I'd like to repeat the exercise with an App (iOS for now and OS X later).

Even if I know about object oriented programming (I work using C++), I'm new to Object-C and this is my first App so I still have to learn a lot about XCode, iOS SDK and other stuff.


Now my question:

what's the easiest way to reproduce my data structure?


Googling a bit I've seen that the two most used approaches are to manage data through SQLite or Core Data. Both these options are not directly compatible with the DB I already have; this means that portability becomes another important variable if I want to develop for different frameworks.


Thanks in advance for any suggestion! I will really appreciate if you could also point me to tutorials or guides regarding this topic.



Bye...

MacBook Air (13-inch Late 2010), OS X Mountain Lion (10.8.3)

Posted on Apr 1, 2013 5:11 AM

Reply
4 replies

Apr 1, 2013 8:31 AM in response to TShirt

TShirt wrote:


1 - Why do you suggest Core Data istead of SQLite3 ?


Because using native SQLite is a roll-your-own approach. Sometimes that is a good idea. I had an app that used native SQLite to access a pre-built database. Using Core Data for that is overkill and not necessary.


However, if this is data that you plan to update within the app, that is different. You would have to do a lot of work to manage your data and manage your tables. You can certainly do that, but then if you want advance your app and move into iCloud, you will have to re-do it all.


Core Data is written from a programmer perspective, not a database perspective. If you are thinking in terms of a database then it seems silly to go through all the hassle. But once you are writing your software and interacting with the user interface, it is much easier to deal with data as objects with built-in relations to other objects. Core Data is a lot of effort for a small project, but once accomplished, it will scale easily and with far less effort on your part.


2 - Why "Be patient" ? It's hard to implement what I need ?


Core Data is just difficult conceptually if you are used to working databases natively. In my example above where I used SQLite natively, I had an ulterior motive - I didn't understand Core Data. I still don't fully understand it because I haven't had time to work with it. But I'm making progress. I have made enough progress that I can definitely assure you that thinking from a database perspective is just going to hold you back. That perspective is easier to understand conceptually than Core Data, but harder to get a working, real-world app. That is, of course, the ultimate goal.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Database in iOS App

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.