我想整合 Aviary SDK Objective-C 库到 Monotouch 项目中。我为此使用“Monotouch Binding Project”模板。所以我创建了 API 定义文件并定义了 LinkWith 属性。
[assembly: LinkWith ("libAviarySDK.a", LinkTarget = LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true, IsCxx = true, Frameworks="CoreGraphics QuartzCore Accelerate StoreKit CoreData", LinkerFlags="-ObjC -all_load -fobjc-arc")]
它需要以下库:
- 基础.框架
- UIKit.framework
- CoreGraphics.framework
- QuartzCore.framework
- Accelerate.framework
- StoreKit.framework
- libz.1.2.5.dylib
- libsqlite3.0.dylib
- 核心数据框架
除了 libsqlite3.0.dylib 之外,所有这些框架都没有问题地链接
不过,我遇到的问题是该库依赖于 libsqlite3.0.dylib,我不知道如何将这些框架包含在我的 MonoTouch 应用程序中。
在结果中 - 编译器返回以下错误:
/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/2n/ql7wkht57cg8wfgzz0cr9trm0000gn/T/tmp31d0b99b.tmp/libAviarySDK.a -ObjC -all_load -fobjc-arc
Undefined symbols for architecture i386:
"_sqlite3_open", referenced from: -[AFLocalyticsDatabase init] in libAviarySDK.a(AFLocalyticsDatabase.o)
"_sqlite3_busy_timeout", referenced from: -[AFLocalyticsDatabase init] in libAviarySDK.a(AFLocalyticsDatabase.o)
"_sqlite3_exec", referenced from: -[AFLocalyticsDatabase beginTransaction:] in libAviarySDK.a(AFLocalyticsDatabase.o)
* And many other same references *
ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status
mtouch exited with code 1
最佳答案
尝试将 -lsqlite3.0
添加到您的 LinkerFlags
以便您的绑定(bind)指示( native )链接器加载 SQLite 库(和符号)。
[assembly: LinkWith ("your_lib.a", LinkTarget.ArmV7, ForceLoad = true, LinkerFlags="-lsqlite3.0")]
关于binding - 如何在 MonoTouch 绑定(bind)项目中添加 libsqlite3.0.dylib?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10898244/