【问题标题】:Xamarin.Forms PCL & ServiceStack 4.5Xamarin.Forms PCL 和 ServiceStack 4.5
【发布时间】:2017-02-09 11:28:36
【问题描述】:

我有一个 Xamarin.Forms PCL 项目,配置文件 7。我正在尝试解决在尝试创建 JsonServiceClient 的新实例时出现的一些错误:

System.ArgumentException: PclExport.Instance 需要初始化

System.TypeInitializationException:“ServiceStack.ServiceClientBase”的类型初始化程序引发了异常。

搜索我的错误,我发现:

IosPclExportClient.Configure()

AndroidPclExportClient.Configure()

但是,我不确定这是否适用于此,因为 Forms PCL 项目抽象出了 iOS/Android/等的细节。

非常感谢!

【问题讨论】:

    标签: android .net xamarin xamarin.forms servicestack


    【解决方案1】:

    PCL 对其进行抽象,这是正确的。但是您需要在您的AppDelegateApplication.Main() 中调用IosPclExportClient.Configure()AndroidPclExportClient.Configure() 在您的MainActivity 中,因为它们正在初始化一些特定于平台的对象,这些对象可以在您之后共享代码中使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多