c# - 如何从我的绑定(bind)中引用其他框架?

标签 c# ios binding xamarin xamarin.ios

我正在尝试绑定(bind)一个依赖于多个框架的库。以下是有关如何在 xcode 上进行设置的文档:http://sdk.camera360.com/page/iosguide .

本质上它依赖于以下外部框架:

pg_edit_sdk_common.framework 
pg_edit_sdk_cdb_piratesdk.framework

以下 iOS 框架:

CoreMotion.framework
AVFoundation.framework
CoreMedia.framework
CoreData.framework
CoreGraphics.framework
CoreImage.framework
ImageIO.framework
libstdc++.6.dylib
libz.1.2.5.dylib

听起来它还需要标志:

-std=c++11 and -all_load

我正在利用 Sharpie 和绑定(bind)项目绑定(bind) PhotoEditFrameWork.aPhotoEditFramework.linkwith.cs 如下所示:

[assembly: LinkWith ("PhotoEditFramework.a", SmartLink = true, ForceLoad = true, 
    Frameworks="CoreMotion AVFoundation CoreMedia CoreData CoreGraphics CoreImage ImageIO", 
    LinkerFlags = "-all_load -lstdc++.6 -lz.1.2.5 -std=c++11")]

但是当我尝试运行该应用程序时,出现以下错误:

    MTOUCH: error MT5209: Native linking error: warning: ignoring file /Code/Tests/Camera360/Camera360Test/obj/iPhoneSimulator/Debug/mtouch-cache/PhotoEditFramework.a, missing required architecture i386 in file /Code/Tests/Camera360/Camera360Test/obj/iPhoneSimulator/Debug/mtouch-cache/PhotoEditFramework.a (2 slices)
    MTOUCH: error MT5214: Native linking failed, undefined symbol: _PhotoEditFrameworkVersionString. This symbol was referenced by the managed member Camera360.Constants.PhotoEditFrameworkVersionString. Please verify that all the necessary frameworks have been referenced and native libraries linked.
    MTOUCH: error MT5214: Native linking failed, undefined symbol: _PhotoEditFrameworkVersionNumber. This symbol was referenced by the managed member Camera360.Constants.PhotoEditFrameworkVersionNumber. Please verify that all the necessary frameworks have been referenced and native libraries linked.

第一个错误与模拟器有关。这是因为库缺少 i386 目标吗? 我认为另外两个错误与对 pg_edit_sdk_common.frameworkpg_edit_sdk_cdb_piratesdk.framework 的引用有关。如何在 LinkWith 上引用这两个框架。另外,我还需要绑定(bind)那些吗?

最佳答案

您的第一个假设是正确的。 native 库可能缺少 i386 的目标。您可以按照说明进行确认 here .

要解决外部框架的问题,您可以根据需要向绑定(bind)项目中添加尽可能多的必需 native 库。在这种情况下,从所需的 pg_*.framework 文件中获取 native .a 文件并将它们添加到绑定(bind)项目中。

注意* 添加 .a 库后,您将获得这些库的更多 LinkWith.cs 文件。确保设置了 LinkTarget。我注意到你现有的也没有。更新那个。它应该是这样的:

LinkTarget = LinkTarget.ArmV6 |链接目标.ArmV7 | LinkTarget.模拟器

但是,您需要确保 LinkTarget 匹配 .a 支持的任何内容。使用第一个链接中的技术检查 (lipo -info)

还有一些其他解决方法已注明 here如果上述情况不适用。

关于c# - 如何从我的绑定(bind)中引用其他框架?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36225261/

相关文章:

c# - 无法在 WPF 中使用 IMultiValueConverter 以允许公制或英制输入

javascript - 我想将单击事件绑定(bind)到 xpages type-ahead 中的 li 元素

ios - 为什么 ViewDidLoad() 中的 self.currentViewController 为 nil?

ios - 自定义 webview 键盘问题

c# - 如何在 Windows 窗体应用程序中实现键盘按键

c# - 合并两个表达式的结果

ios - Xcode View 层次结构调试器 - "prototyping"

Java/Swing : the fast/slow UI binding problem

c# - WPF 应用程序上的闪烁按钮

c# - 如何使用 .NET Core 和 EF 将图像文件保存到 SQL 数据库