1

I am sorry for asking such a noob question. I know that one way of storing data on the iphone via database is using SQLite, but after reading for a while it seems that the database is local and therefore each application has a copy of the database? is this right? if that is the case then what if I have two ipod with the same apps. and ipod A wants to update the database, then the data isn't reflected on ipod B?? Sorry for the noob questions

MPelletier
16.8k18 gold badges91 silver badges140 bronze badges
asked Jan 22, 2011 at 7:13
4
  • Yes. You are right. Every app has its own copy of the resources and assets. The database in your iPod A has no chance to have relationship with the database in your iPod B, except by using a web service.. Commented Jan 22, 2011 at 7:27
  • So is there a way to have a centralized database in a server and have the iPhone connected to it? Commented Jan 22, 2011 at 7:29
  • Yes. You can do it like that. Whenever an app updates any data in database, you send it to the server. And you can update the database from server at regular intervals. Commented Jan 22, 2011 at 7:33
  • So how can I connect the iPhone to database such as MySQL or SQL Server Commented Jan 22, 2011 at 16:35

1 Answer 1

1

You overcome this by having a server which can synchronise the data between the apps. This is actually a much bigger problem than you might first think. In sonatribe.com we're having to consider situations where users aren't connected to the internet - so we queue the users actions and then push the data to the server when the device is connected. You then have to consider which database is the priority? Which one over writes the other when there are conflicts.

We also release new data for new events regularly - this data is then synchronised when the app is fired up.

One of the lessons we learned was that it's better to keep the number of calls down - connecting is expensive - but once connected the flow of data is fast.

FWIW - we went with MonoTouch - and the main reason was for the integration with WCF and the data capabilities (LINQ) of .NET. Using the SIlverlight profile and svcutil it's easy to get connected and communicate with web services passing complex objects over the wire - very handy for this sort of thing.

You also need to consider users who are on a limited data contract. We have the ability to turn off auto synch with the server in the settings. This is also useful for when our users are actually at the music festivals - in the UK, reception is renowned for being bad at events like this due to the sheer volume of people in one space. Although this is improving, users will appreciate the fact that they can stop the app communicating with a server on their behalf.

answered Jan 22, 2011 at 7:27
Sign up to request clarification or add additional context in comments.

3 Comments

just wondering why didn't you use REST using the WCF Data Service if you are using .NET
The client API for Wcf in Monotouch isn't 100% complete. Setting it up as standard is the most stable and less complex of the options. AFAIK obv - i'd love to hear of other ways. This was what was best last summer - this summer I'm re-coding a lot of the app so will look at this again :)
Also, by using the Silverlight profile and svcutil, I can use the generated proxies which return typed objects back - no xml parsing or any of that mess: wiki.monotouch.net/HowTo/WebServices/Using_WCF

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.