【问题标题】:Async/await in PCL Profile 158 targeting Android and IOS tooPCL Profile 158 中的异步/等待也针对 Android 和 IOS
【发布时间】:2014-01-24 17:00:37
【问题描述】:

我有一个带有 Android 和 IOS 的 PCL 配置文件 158。我也想使用异步/等待。 我为这个问题找到了一些解决方案,但我无法让它工作。

当我尝试使用 await 时,visual/xamarin studio 显示错误消息:Type 'System.Threading.Tasks.Task<...>' is not awaitable。

有没有办法让它工作或使用异步/等待操作的替代方法?

【问题讨论】:

    标签: c# asynchronous xamarin.ios xamarin.android portable-class-library


    【解决方案1】:

    您是否还安装了 Microsoft.Bcl.Async 的 nuget 包?我认为您需要在 PCL 中获得 async/await。

    【讨论】:

    • 我之前试过,但是显示不兼容的错误:无法安装包'Microsoft.Bcl.Build 1.0.13'。您正在尝试将此软件包安装到以“portable-win+net45+sl50+wp80+MonoAndroid10+MonoTouch10”为目标的项目中
    • @ThiagoRomam 安装最新版本的 NuGet(2.7.2 或更高版本),您应该能够在便携式库中安装 Microsoft.Bcl.Async NuGet 包。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-22
    • 1970-01-01
    • 2021-10-04
    • 2018-01-15
    相关资源
    最近更新 更多