Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Whatsapp API旧版本错误_C#_Nuget_Console Application_Whatsapp_Whatsapi - Fatal编程技术网

C# Whatsapp API旧版本错误

C# Whatsapp API旧版本错误,c#,nuget,console-application,whatsapp,whatsapi,C#,Nuget,Console Application,Whatsapp,Whatsapi,我一直在尝试让我的whatsapp控制台应用程序工作。不幸的是,在尝试注册时,我遇到了一个错误:旧版本。 以下是我的程序在控制台中记录的内容(程序代码如下): 有人知道我如何更新whatsapp API吗?这是我的NuGet软件包管理器中当前最新的版本。我知道有两种版本,我都试过了,但都没有成功 我使用的是.NETFramework解决方案,而不是.NETCore,因为我正在处理的是由microsoft引起的NuGet package manager错误。此外,我还在.NET框架中使用其他NuG

我一直在尝试让我的whatsapp控制台应用程序工作。不幸的是,在尝试注册时,我遇到了一个错误:旧版本。 以下是我的程序在控制台中记录的内容(程序代码如下):

有人知道我如何更新whatsapp API吗?这是我的NuGet软件包管理器中当前最新的版本。我知道有两种版本,我都试过了,但都没有成功

我使用的是.NETFramework解决方案,而不是.NETCore,因为我正在处理的是由microsoft引起的NuGet package manager错误。此外,我还在.NET框架中使用其他NuGet包,如Discord.NET

所以我可以在NuGet包管理器中找到2个Whatsapp API。API的第一个版本在v1.2.2上,另一个版本在v15.4.29上

另外,我想添加用于注册的代码

bool registrationSucces = WhatsRegisterV2.RequestCode(number, out password, out error);
要完全重现错误,请执行以下操作: 使用前面提到的两个可用的nuget软件包(v1.2.2或v15.4.29上的版本)


我期待着有更多API或编码知识的人能帮助我解决这个难题。

下载github这个项目 尝试以下配置:

    using System;
    using System.Globalization;

    namespace WhatsAppApi.Settings
       {
               /// <summary>
               /// Holds constant information used to connect to whatsapp 
             server
                 /// </summary>
                  public class WhatsConstants
                   {
                    #region ServerConstants

        /// <summary>
        /// The whatsapp host
        /// </summary>
        public const string WhatsAppHost = "c3.whatsapp.net";

        /// <summary>
        /// The whatsapp XMPP realm
        /// </summary>
        public const string WhatsAppRealm = "s.whatsapp.net";

        /// <summary>
        /// The whatsapp server
        /// </summary>
        public const string WhatsAppServer = "s.whatsapp.net";

        /// <summary>
        /// The whatsapp group chat server
        /// </summary>
        public const string WhatsGroupChat = "g.us";

        /// <summary>
        /// The whatsapp version the client complies to
        /// </summary>
        //public const string WhatsAppVer = "2.13.21";
        //public const string WhatsAppVer = "2.12.440";
        //public const string WhatsAppVer = "2.12.556";
        public const string WhatsAppVer = "2.19.368";

        /// <summary>
        /// The port that needs to be connected to
        /// </summary>
        public const int WhatsPort = 443;

        /// <summary>
        /// iPhone device
        /// </summary>
        //  public const string Device = "S40";
        public const string Device = "Android";

        /// <summary>
        /// manufacturer
        /// </summary>
        public const string Manufacturer = "HTC";

        /// <summary>
        /// OS Version
        /// </summary>
        public const string OS_Version = "4.3";

        /// <summary>
        /// The useragent used for http requests
        /// </summary>
        //public const string UserAgent = "WhatsApp/2.13.21 S40Version/14.26 Device/Nokia302";
        //public const string UserAgent = "WhatsApp/2.12.440 Android/4.3 Device/Xiaomi-HM_1SW";
        public const string UserAgent = "WhatsApp/2.19.368 Android/4.3 Device/endeavoru-IMM76D";


        #endregion

        #region ParserConstants
        /// <summary>
        /// The number style used
        /// </summary>
        public static NumberStyles WhatsAppNumberStyle = (NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign);

        /// <summary>
        /// Unix epoch DateTime
        /// </summary>
        public static DateTime UnixEpoch = new DateTime(0x7b2, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
        #endregion
    }
}
使用系统;
利用制度全球化;
名称空间WhatsAppApi.Settings
{
/// 
///保存用于连接whatsapp的常量信息
服务器
/// 
公共类WhatConstants
{
#区域服务器常数
/// 
///whatsapp主持人
/// 
public const string WhatsAppHost=“c3.whatsapp.net”;
/// 
///whatsapp XMPP领域
/// 
public const string WhatsAppRealm=“s.whatsapp.net”;
/// 
///whatsapp服务器
/// 
public const string WhatsAppServer=“s.whatsapp.net”;
/// 
///whatsapp群组聊天服务器
/// 
public const string WhatsGroupChat=“g.us”;
/// 
///客户遵守的whatsapp版本
/// 
//public const string WhatsAppVer=“2.13.21”;
//public const string WhatsAppVer=“2.12.440”;
//public const string WhatsAppVer=“2.12.556”;
public const string WhatsAppVer=“2.19.368”;
/// 
///需要连接到的端口
/// 
公共const int WhatsPort=443;
/// 
///iPhone设备
/// 
//public const string Device=“S40”;
public const string Device=“安卓”;
/// 
///制造商
/// 
public const string Manufacturer=“HTC”;
/// 
///操作系统版本
/// 
公用常量字符串OS_Version=“4.3”;
/// 
///用于http请求的useragent
/// 
//public const string UserAgent=“WhatsApp/2.13.21 S40版本/14.26设备/Nokia302”;
//public const string UserAgent=“WhatsApp/2.12.440安卓/4.3设备/Xiaomi-HM_1SW”;
public const string UserAgent=“WhatsApp/2.19.368安卓/4.3设备/奋进-IMM76D”;
#端区
#区域ParserConstants
/// 
///使用的数字样式
/// 
公共静态NumberStyles WhatsAppNumberStyle=(NumberStyles.AllowDecimalPoint | NumberStyles.AllowReadingSign);
/// 
///Unix纪元日期时间
/// 
public static DateTime UnixEpoch=new DateTime(0x7b2,1,1,0,0,DateTimeKind.Utc);
#端区
}
}

如果你能提供一个详细的信息,并提及你正在使用的软件包版本号,那就太棒了。我编辑了原始文章,因此它包含了更好、更多的信息。感谢您提供有关如何在此论坛上正确发布编码问题的反馈。您至少应该提供有关您正在使用的Library/NuGet软件包的信息。
WhatsRegisterV2
类与之匹配,例如,它从2006年就已经过时了(在WA的E2EE之前,所以这肯定不起作用)@Lion我确实指定了我尝试过的nuget软件包的版本。两者都返回了相同的错误。另外:如果我的API真的过时了,原因是什么?我无法在.Net控制台中进一步更新NuGet包Application@jellekeulemans请注意,并非每个人都能看到pastebin
    using System;
    using System.Globalization;

    namespace WhatsAppApi.Settings
       {
               /// <summary>
               /// Holds constant information used to connect to whatsapp 
             server
                 /// </summary>
                  public class WhatsConstants
                   {
                    #region ServerConstants

        /// <summary>
        /// The whatsapp host
        /// </summary>
        public const string WhatsAppHost = "c3.whatsapp.net";

        /// <summary>
        /// The whatsapp XMPP realm
        /// </summary>
        public const string WhatsAppRealm = "s.whatsapp.net";

        /// <summary>
        /// The whatsapp server
        /// </summary>
        public const string WhatsAppServer = "s.whatsapp.net";

        /// <summary>
        /// The whatsapp group chat server
        /// </summary>
        public const string WhatsGroupChat = "g.us";

        /// <summary>
        /// The whatsapp version the client complies to
        /// </summary>
        //public const string WhatsAppVer = "2.13.21";
        //public const string WhatsAppVer = "2.12.440";
        //public const string WhatsAppVer = "2.12.556";
        public const string WhatsAppVer = "2.19.368";

        /// <summary>
        /// The port that needs to be connected to
        /// </summary>
        public const int WhatsPort = 443;

        /// <summary>
        /// iPhone device
        /// </summary>
        //  public const string Device = "S40";
        public const string Device = "Android";

        /// <summary>
        /// manufacturer
        /// </summary>
        public const string Manufacturer = "HTC";

        /// <summary>
        /// OS Version
        /// </summary>
        public const string OS_Version = "4.3";

        /// <summary>
        /// The useragent used for http requests
        /// </summary>
        //public const string UserAgent = "WhatsApp/2.13.21 S40Version/14.26 Device/Nokia302";
        //public const string UserAgent = "WhatsApp/2.12.440 Android/4.3 Device/Xiaomi-HM_1SW";
        public const string UserAgent = "WhatsApp/2.19.368 Android/4.3 Device/endeavoru-IMM76D";


        #endregion

        #region ParserConstants
        /// <summary>
        /// The number style used
        /// </summary>
        public static NumberStyles WhatsAppNumberStyle = (NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign);

        /// <summary>
        /// Unix epoch DateTime
        /// </summary>
        public static DateTime UnixEpoch = new DateTime(0x7b2, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
        #endregion
    }
}