Xamarin Forms Dependency Service定义问题

安东内洛·加托

我正在使用Xamarin开发和应用程序,并且试图遵循本指南,以便为UWP实现Xamarin Forms并与其接口。

所以我在PCL中写了这个界面:

namespace MyApp {
public interface ISimplePdfLoader {

    void OpenLocal(string uri);

    void Load(object pdfDoc);
  }
}

在MyApp.UWP中,我创建了一个类:

[assembly: Dependency(typeof(SimplePdfLoader))]
namespace MyApp.UWP {
public class SimplePdfLoader : ISimplePdfLoader {

    public async void OpenLocal(string uri) {
        ...

        Load(doc);
    }

    public async void Load(object pdfObj) {
        ...
        }
    }
}
}

但是它继续显示error CS7036 No arguments matching the mandatory formal parameter 'loadHintArgument' of 'DependencyAttribute.DependencyAttribute (string, LoadHint)'指定的MyApp.UWP C:\ Users ... \ workspace \ my-app \ MyApp \ MyApp.UWP \ SimplePdfLoader.cs 19,但我无法编译该项目。

编辑:错误显示在该行的下面[assembly: Dependency(typeof(SimplePdfLoader))]

阿卜杜勒·加尼|

从顶部使用部分删除以下行

using System.Runtime.CompilerServices;

并添加以下内容

using Xamarin.Forms;

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章