Xamarin.iOS与第三方框架的绑定 [英] Xamarin.iOS binding with third party framework

查看:270
本文介绍了Xamarin.iOS与第三方框架的绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我知道SVGKit支持这些架构,但是我不确定从.framework引用时如何将它们包括在生成的二进制文件中.

解决方案

您好,我将这样做来诊断问题

首先,我将使用以下命令检查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并将其添加到您的绑定项目中,它便会照常工作

如果它是动态框架,请遵循以下说明关于如何做.[0]

[0]:附带一提,一旦Xamarin Studio 6.0推出,您将无需手动修改绑定项目.csproj文件,您将能够在IDE本身内完成它:)

I am trying to update a Xamarin.iOS binding which points to code that I manage, and I'm having trouble now that I've replaced an external .a library reference with a .framework. Particularly, when I try to compile my binding, native linking is failing for the library which I replaced.

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

I know for a fact that SVGKit supports these architectures, but I'm unsure how to include them in the generated binary when referencing from a .framework.

解决方案

Hello I would do this to diagnose the issue

First I would check if SVGKit.framework/SVGKitis a fake framework (static library disguised as a framework) or a dynamic one (iOS 8+ support only) using the file command on the binary

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 is a dynamic library, notice the Mach-O and Bar is a static library disguised as a framework notice the ar

Now if it is a fake framework (static library) just take the SVGKit.framework/SVGKit binary and rename it to SVGKit.a and add it to your binding project, it should work as usual

If it is a Dynamic Framework then follow these instructions on how to do it.[0]

[0]: Just a side note, once Xamarin Studio 6.0 is out you will not need to manually modify the binding project .csproj file, you will be able to do it within the IDE itself :)

这篇关于Xamarin.iOS与第三方框架的绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆