MonoTouch中的数据库磁盘映像格式错误 [英] Database disk image is malformed in MonoTouch

查看:87
本文介绍了MonoTouch中的数据库磁盘映像格式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Monotouch 5开发多线程消息传递应用程序。经过几天的操作,一些客户收到错误数据库磁盘映像格式错误。我正在使用我在互联网上找到的Kueger Systems的 SQLite.cs 来访问SQLite数据库。

I am using Monotouch 5 to develop a multithreaded messaging application. After some days of operation, some customers receive the error Database disk image is malformed. I am using the SQLite.cs from Kueger Systems I found in the internet to access the SQLite database.

似乎有多个线程访问数据库的问题(发生了很多)。我已经阅读过关于如何编译数据库的选项(单线程,多线程,序列化)。我是否以某种方式指定了?

It appears there is an issue woth multiple threads accessing the database (which happens a lot). I have read somewhere about an option how the database is compiled (Single thread, multi thread, serialized). Do I specify that somehow?

我想继续从后台线程更新数据库,而不会破坏它。我做错了什么?

I want to continue updating the database from background threads, without corrupting it. What am I doing wrong?

推荐答案

你可以告诉 sqlite 如何处理多线程。诀窍是在你的应用程序的早期非常(因为一旦初始化sqlite,改变它就太晚了。)

You can tell sqlite how to deal with multithreading. The trick is to do it very early in your application (because once sqlite is initialized it will be too late to change it).

For SQLite.cs你可以使用这个代码。

For SQLite.cs you can do this using this code.

Mono.Data.Sqlite.dll 你可以调用 Mono.Data.Sqlite.SqliteConnection.SetConfig(Mono.Data.Sqlite.SQLiteConfig。*); 来做同样的事。

In Mono.Data.Sqlite.dll you can call Mono.Data.Sqlite.SqliteConnection.SetConfig (Mono.Data.Sqlite.SQLiteConfig.*); to do the same.

在这两种情况下都记录了有效值(对于配置枚举)这里

In both case the valid values (for the config enum) are documented here.

这篇关于MonoTouch中的数据库磁盘映像格式错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆