【问题标题】:Xamarin.Essentials causes crash in Xamarin.Forms.macOSXamarin.Essentials 导致 Xamarin.Forms.macOS 中的崩溃
【发布时间】:2020-07-16 00:27:22
【问题描述】:

在遵循本指南之后,我正在构建一个 Xamarin.Forms.MacOS 应用程序: https://docs.microsoft.com/sv-se/xamarin/essentials/get-started?tabs=windows%2Cios

在这个应用程序中,我想使用 Xamarin.Essentials。我可以成功地将这个包添加到我的 macOS 项目中,但是在启动过程中我遇到了以下错误消息:

This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.

我已经尝试添加代码sn-p:

Xamarin.Essentials.Platform.Init(this, savedInstanceState);

在 macOS 的AppDelegate 文件中的public override void DidFinishLaunching(NSNotification notification) 方法中,但是在查找.Platform 的引用时出现问题。

如何让 Xamarin.Essentials 为 Xamarin 表单在 macOS 上工作?

【问题讨论】:

    标签: c# xamarin xamarin.forms


    【解决方案1】:

    Xamarin.Essentials 目前支持 macOS。自 2018 年以来,这一直是一个悬而未决的问题,因为该平台没有官方赞助商,也没有 Linux、WinForms 等......

    iOS - Supported By Microsoft
    Android - Supported By Microsoft
    UWP - Supported By Microsoft
    macOS
    WinForms/WPF
    GTK#
    Tizen - Supported by Samsung
    watchOS - Supported By Microsoft
    tvOS - Supported By Microsoft
    

    其他平台支持 #662

    ma​​cOS 支持 #111

    注意:这可能会在 Essentials v1.6 版本中有所改变,但官方文档中仍未列出:https://docs.microsoft.com/en-us/xamarin/essentials/platform-feature-support

    注意:有一些“非官方”分支提供了对 macOS 的相当完整的支持,您需要克隆,可能与官方 repo 合并并自己构建它。查看支持 macOS 的个人分支的上述 github 问题。

    【讨论】:

    • 注意到了。非常感谢您提供的信息和链接。你知道是否有关于我如何将我的 xamarin 版本用于这些非官方分叉的指南?我可以通过单击“显示预发布包”并添加未来的 nuget 版本来做到这一点吗?
    • @DiddanDo 不,没有支持 macOS 的 Essentials 官方“预发布包”,因为尚未合并支持 macOS 的 PR。这种“可能”会在 v1.6 版本中发生,但由于 Xamarin.Mac 的开发/用户群如此之小,因此多年来一直缺乏来自 MS/Xamarin 的 macOS 资源。
    • @DiddanDo 指导?您可以按照官方 repo (github.com/xamarin/Essentials) 中的自述文件和构建脚本先开始构建官方 repo,然后合并此 PR 作为添加 macOS github.com/xamarin/Essentials/pull/653 的开始(查看 PR cmets 以查看哪些功能目前支持)。
    猜你喜欢
    • 1970-01-01
    • 2018-01-23
    • 2020-12-02
    • 2013-11-11
    • 2011-01-24
    • 2015-02-23
    • 2011-04-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多