【问题标题】:Using SQLCipher with MonoTouch将 SQLCipher 与 MonoTouch 一起使用
【发布时间】:2012-02-26 21:13:02
【问题描述】:

我编译了一个静态库并链接了 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 来调用 key 函数,在每个 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 

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

【问题讨论】:

    标签: ios sqlite xamarin.ios sqlcipher entrypointnotfoundexcept


    【解决方案1】:

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

    由于路径问题,尝试构建“Debug|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 而丢失了?

    【讨论】:

    • 哈哈,业余的错误!当我调整构建参数时效果很好。现在我只需要记录这个过程!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-25
    • 1970-01-01
    相关资源
    最近更新 更多