Xamarin.Forms便携式类库项目与Sharp.XMPP库 [英] Xamarin.Forms Portable Class Library Project with Sharp.XMPP library

查看:969
本文介绍了Xamarin.Forms便携式类库项目与Sharp.XMPP库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

针对具体问题已发生在我的项目。我已经找到了C#支持的Andr​​oid(在Xamarin)仅一个库: Sharp.XMPP ,< A HREF =htt​​ps://www.nuget.org/packages/Sharp.Xmpp/相对=nofollow>的NuGet ,但我有它的烦恼。当我写在分开的便携式类库的一些示例code,我得到这些错误:

an specific issue has occured in my project. I've found only one library for C# supporting Android (in Xamarin): Sharp.XMPP, NuGet, but I have troubles with it. When I write some sample code in separated portable class library, I get these errors:

Error 1: '.ctor' is not supported by the language

而行

using (XmppClient client = new XmppClient(hostname, username, password))
            {
              ...
            }

下一页:

Error 2: Metadata file '...\Project.Jabber.dll' could not be found  
Warnings 2-6: Reference to type 'System.Net.Security.RemoteCertificateValidationCallback' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile78\System.dll', but it could not be found   c:\Users\Kliford\Downloads\S22.Xmpp\S22.Xmpp.dll 

我无言以对。
谢谢你在前进。

I am clueless. Thank you in advance.

推荐答案

Sharp.Xmpp 是不是与 PCL兼容,因为它使用的的XmlElement 类,它目前还不可用 PCL

Sharp.Xmpp is not compatible with PCL since it uses the XmlElement class, which is not currently available in PCL.

重写这部分是可行的,但需要显著努力。

Rewriting this part is doable, but requires a significant effort.

这是我使用的解决方法,是制定 .NET 4.5 类库,它引用 Sharp.XMPP 的Windows之间的可移植性通过 Xamarin 实现。

The workaround that I use, is to develop .Net 4.5 Class libraries, which reference Sharp.XMPP. Portability among Windows and .Net is achieved through Xamarin.

希望这有助于

这篇关于Xamarin.Forms便携式类库项目与Sharp.XMPP库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆