如何从我的绑定中引用其他框架?

时间:2016-03-25 17:58:31

标签: c# ios binding xamarin xamarin.ios

我正在尝试绑定一个依赖于多个框架的库。以下是有关如何在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

我使用PhotoEditFrameWork.a绑定Sharpie和绑定项目。 PhotoEditFramework.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上引用这两个框架。此外,我还需要绑定它们吗?

1 个答案:

答案 0 :(得分:1)

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

要解决外部框架的问题,可以根据需要在绑定项目中添加任意数量的必需本机库。在这种情况下,从所需的pg _ *。framework文件中获取本机.a文件,并将它们添加到绑定项目中。

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

LinkTarget = LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator

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

如果上述内容不适用,还有其他一些注意事项here