Xamarin.iOS与第三方框架绑定

时间:2016-04-12 21:29:53

标签: c# ios xamarin xamarin.ios xamarin.ios-binding

我正在尝试更新指向我管理的代码的Xamarin.iOS绑定,而且我现在遇到了麻烦,因为我用.framework替换了外部.a库引用。特别是,当我尝试编译我的绑定时,本机链接对于我替换的库失败了。

Native linking error: framework not found SVGKit for architecture arm64/i386/armv7/armv7s (MT5209)

我知道SVGKit支持这些体系结构这一事实,但我不确定如何在从.framework引用时将它们包含在生成的二进制文件中。

1 个答案:

答案 0 :(得分:3)

您好我会这样做来诊断问题

首先,我会检查SVGKit.framework/SVGKit虚假框架(伪装成框架的静态库)还是动态框架( iOS 8+仅支持)在二进制文件

上使用file命令
file Foo.framework/Foo
Foo.framework/Foo: Mach-O universal binary with 4 architectures
Foo.framework/Foo (for architecture i386):  Mach-O dynamically linked shared library i386
Foo.framework/Foo (for architecture x86_64):Mach-O 64-bit dynamically linked shared library x86_64
Foo.framework/Foo (for architecture armv7): Mach-O dynamically linked shared library arm
Foo.framework/Foo (for architecture arm64): Mach-O 64-bit dynamically linked shared library

file Bar.framework/Bar
Bar.framework/Bar: Mach-O universal binary with 4 architectures
Bar.framework/Bar (for architecture armv7): current ar archive random library
Bar.framework/Bar (for architecture i386):  current ar archive random library
Bar.framework/Bar (for architecture x86_64):current ar archive random library
Bar.framework/Bar (for architecture arm64): current ar archive random library

Foo是一个动态库,请注意Mach-OBar是一个伪装成框架通知的静态库ar

现在,如果它是假框架(静态库),只需取出SVGKit.framework/SVGKit二进制文件并将其重命名为SVGKit.a并将其添加到绑定项目中,它应该可以正常工作像往常一样

如果是动态框架,请遵循这些instructions on how to do it。[0]

[0]:只是旁注,一旦Xamarin Studio 6.0出局,您将无需手动修改绑定项目.csproj文件,您将能够在IDE内部执行此操作:)