简体   繁体   English

本机链接在 xamarin.iOS 中失败

[英]Native linking failed in xamarin.iOS

I am using a native sdk (BrotherPrinter sdk) in my xamarin project, but while building the xamarin.iOS project am getting "Native linking failed" errors.How to fix this please help me on this.我在我的 xamarin 项目中使用本机 sdk (BrotherPrinter sdk),但是在构建 xamarin.iOS 项目时出现“本机链接失败”错误。如何解决这个问题,请帮助我解决这个问题。

I did the following things but it didn't worked.我做了以下事情,但没有用。

Tried with Linker behavior: Don't link, sdk only and Link all尝试使用 Linker 行为:不链接,仅 sdk 和全部链接

Deleting obj and bin files.删除 obj 和 bin 文件。

Clean & Rebuild the solution.清理并重建解决方案。

For the error MT5209 I have changed the architecture, and I hope it will work in real devices.对于错误MT5209,我已经更改了架构,希望它能在真实设备上运行。 These are the errors I am getting.这些是我得到的错误。 在此处输入图像描述

This happens when the native linker cannot find an Objective-C class.当本机 linker 找不到 Objective-C class 时,就会发生这种情况。 You can add the [Protocol] attribute to the api that binds the Objective-C protocol for annotation, this official document can help you solve the problem.可以在绑定Objective-C协议的api中添加[Protocol]属性进行注解, 这个官方文档可以帮你解决问题。

I solved this by simply changing the supported architectures to just x86_64 from iOS properties.我通过简单地将支持的架构从 iOS 属性更改为 x86_64 来解决这个问题。 Double click iOS project to open iOS properties window and set like below.双击iOS项目打开iOS属性window如下设置。 Clean and rebuild;清理和重建; error will be gone.错误将消失。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM