I tried searching a while and I did not find a proper convincing answer. Hence the question. I know plist and mysql are kind of on two opposite ends, but I have a solution approach using plist which can be simple. But I doubt the solution approach and feel it is not an elegant solution.
Model:
User has profile with various information such as name, email, date of birth etc. He also has a set or list of other information such as books, hobbies etc. So essentially from a plist perspective it will be nested arrays.
<name>
<email>
<date of birth>
<books>
<book1>
<book2>
<Hobbies>
<hobby1>
<hobby2>
...
From a mysql db perspective, there will be 3 tables. One for profile, one for books and one for hobbies. One row per profile with foreign key to Books and Hobbies table.
Problem:
I need to store this information on the server and retrieve on iphone on request
Remember, this user will be able to view the profile of various other users based upon some filter criteria. So all I am asking is where and how to store the profile information of all the users, and such that this user can view them on his iphone when he wants to.
Solution approaches:
Approach 1: (using plist)
For every user, store a plist file on the server. To get the information on iphone, create a http request to get the plist, then display info on iphone from plist using standard methods.
So if the server is at xyz.com, I can get the plist at path xyz.com/userid/profile.plist
Approach 2: (using mysql)
Store the data in mysql database. Send http request to access a php file. The php code queries the profile table by userid, and then queries the Books and Hobbies table by the foreign keys. Create an array of the result. And send the resultant array back to iphone. iPhone now displays profile info from that array.
Which approach is better for a best practices, performance and scalability perspective?
There would be eventually 1000s of profiles. In the first approach that means there will 1000 different plist files on server. In second approach it means 1000 rows in profile table.
Approach 3: (using [insert server side database name] and CoreData or SQLite)
Create you tables in [insert server side database name] and then create the necessary table structures/entity model for your device. When a user does not have any data on the device make an http request, insert into to your local store on the device, and read from the device from then on or until an update is required.