ios - 将 SQLCipher 与 MonoTouch 结合使用

标签 ios sqlite xamarin.ios sqlcipher entrypointnotfoundexcept

我编译了一个静态库并链接了 SQLCipher 和 OpenSSL。完整的项目、makefile 和编译的库可以在这里找到:

https://github.com/anujb/SQLCipherNet

当我在普通 Objective-C Xcode 项目中链接生成的库时,对 sqlite3_key 的调用工作正常。

我使用以下方法将相同的库链接到 MonoTouch 项目中:

-gcc_flags "-L${ProjectDir} -lsqlciphernet -force_load ${ProjectDir}/libsqlciphernet.a"

然后我修改了 SQLite-NET 以在每个 SQLite3.Open(...) 函数之后调用关键函数:

[DllImport("__Internal", EntryPoint = "sqlite3_key")]
public static extern Result Key(IntPtr db, string key, int keyLength);

但是当调用 Key 方法时,我得到了 EntryPointNotFoundException。这是堆栈跟踪:

System.EntryPointNotFoundException has been thrown at:
at (wrapper managed-to-native) SQLite.SQLite3:Decrypt (intptr,string,int)
at SQLite.SQLiteConnection..ctor (System.String databasePath) [0x00031] in 
../SQLite.cs:108 

显然,堆栈跟踪并不是特别有用,但我不知道从哪里开始调试这个问题。哈尔普?

最佳答案

在为“Debug|iPhoneSimulator”构建解决方案时,我遇到了同样的错误。但是,对于此配置,您的项目选项包含您提到的gcc_flags - 因此异常是完全正常的。

由于路径问题,尝试构建“调试|iPhone”配置(指定选项的位置)失败...但我很确定如果我修复它们,它会起作用;-)

更新

将库移动到正确的位置可以让我:

Undefined symbols for architecture armv6:   "___udivmodsi4",
referenced from:
      _sqlite3BitvecSet in libsqlciphernet.a(sqlite3.o)
      _sqlite3BitvecClear in libsqlciphernet.a(sqlite3.o)
      _sqlite3BitvecTest in libsqlciphernet.a(sqlite3.o) ld: symbol(s) not found for architecture armv6

我相信它是因为 libopenssl 而丢失的?

关于ios - 将 SQLCipher 与 MonoTouch 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9457209/

相关文章:

ios - 适用于iOS的AS3 AIR-StageVideo无法正常工作

c# - 如何从 viewmodel 使用 iOS/Xamarin 扫描 NFC 标签

ios - UILabel 高度不变

ios - Swift - 使用启动屏幕图像而不是启动屏幕文件时使用 webview 的问题

Swift2.3 : NSMutableDictionary store integer from sqlite

python - 扁平化和解包列表

ios - Xamarin iOS 中的弹出选择器

ios - iOS 7 中 MonoTouch.Dialog 支持拉动刷新

ios - 如何有条件地加载不同的 Storyboard?

sql - Group By + 左外连接 Sqlite