Xamarin 绑定在更新 Xamarin.iOS 和统一 API 后损坏

Xamarin binding broken after updating Xamarin.iOS & unified API

我已经升级了我的 Xamarin 项目并绑定到更新版本的 Xamarin.iOS 并转换为统一的 API。因为这样做我创建的绑定之一导致我的应用程序构建失败并出现错误:

MTOUCHTASK: error MT5211: Native linking failed, undefined Objective-C class: _OBJC_CLASS_$_EAAccessoryManager. If '_OBJC_CLASS_$_EAAccessoryManager' is a protocol from a third-party binding, please check that it has the [Protocol] attribute in its api definition file, otherwise verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
    MTOUCHTASK: error MT5211: Native linking failed, undefined Objective-C class: _OBJC_CLASS_$_EASession. If '_OBJC_CLASS_$_EASession' is a protocol from a third-party binding, please check that it has the [Protocol] attribute in its api definition file, otherwise verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
    MTOUCHTASK: error MT5202: Native linking failed. Please review the build log.

我在绑定中附加的框架确实引用了 EAAccessoryManager 和 EASession,但是我没有在我的 ApiDefinition 中引用它们,因为我不需要或使用这部分功能。什么会导致我的绑定在之前工作正常时中断?

如果您的框架引用了 ExternalAccessory 框架,LinkWith 属性需要这样写:

[assembly: LinkWith (..., Frameworks = "ExternalAccessory", ...)]

恕我直言,问题不在于它为什么在 Unified API 中工作,而是它之前是如何工作的,因为这之前也应该是一个 link 错误(除非你更改了其他构建主项目中的选项)。