简体   繁体   English

SQLite和iPhone

[英]SQLite and iphone

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? 我知道一种通过数据库在iPhone上存储数据的方法是使用SQLite,但是在阅读一段时间之后,似乎该数据库是本地的,因此每个应用程序都有该数据库的副本吗? is this right? 这是正确的吗? if that is the case then what if I have two ipod with the same apps. 如果是这种情况,那么如果我有两个ipod和相同的应用程序该怎么办。 and ipod A wants to update the database, then the data isn't reflected on ipod B?? 和ipod A要更新数据库,则数据不会反映在ipod B上?? Sorry for the noob questions 对不起,菜鸟问题

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. 在sonatribe.com中,我们必须考虑用户未连接到Internet的情况-因此我们将用户操作排队,然后在设备连接后将数据推送到服务器。 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. FWIW –我们选择了MonoTouch –并且主要原因是与WCF和.NET的数据功能(LINQ)集成。 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. 使用SIlverlight配置文件和svcutil,很容易建立连接并与通过有线传递复杂对象的Web服务进行通信-对于此类事情非常方便。

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. 尽管这种情况正在改善,但用户会欣赏这样的事实,即他们可以代表他们停止应用与服务器的通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM