我应该怎么称呼这种方法? [英] How should I call this method?
问题描述
我正在尝试使用whatsApp api创建一个简单的消息传递应用程序。问题是我无法调用请求注册码的方法。我查阅了文档,我无法弄清楚我应该发送什么参数。
这就是给我带来问题的一条线。
I am trying to make an simple messaging app using whatsApp api. The problem is that i can't call the method for requesting the registration code. I've looked up on documentation and i can't figure out what parameters i should send in.
This is the line that is giving me problems.
WhatsAppApi.Register.WhatsRegisterV2.RequestCode(txtPhoneNumber.Text, out password, "sms")
它说我必须提供2个参数。
It saids that i must give 2 out parameters.
Error 1 The best overloaded method match for 'WhatsAppApi.Register.WhatsRegisterV2.RequestCode(string, out string, out string, string, string)' has some invalid arguments
你能帮助我吗?
我尝试过:
Can you help me out?
What I have tried:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LamaChat
{
public partial class Register : Form
{
string password;
public Register()
{
InitializeComponent();
}
private void label4_Click(object sender, EventArgs e)
{
}
private void btnRequest_Click(object sender, EventArgs e)
{
if(string.IsNullOrEmpty(txtPhoneNumber.Text))
{
MessageBox.Show("Please enter your phone number.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtPhoneNumber.Focus();
return;
}
if (string.IsNullOrEmpty(txtFullName.Text))
{
MessageBox.Show("Please enter your phone name.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtFullName.Focus();
return;
}
if(WhatsAppApi.Register.WhatsRegisterV2.RequestCode(txtPhoneNumber.Text, out password, "sms"))
{
}
}
private void btnConfirm_Click(object sender, EventArgs e)
{
}
}
}
推荐答案
查看错误:
Look at the error:
The best overloaded method match for 'WhatsAppApi.Register.WhatsRegisterV2.RequestCode(string, out string, out string, string, string)' has some invalid arguments
这就是说最好的匹配是一个带字符串的方法,两个输出字符串和另外两个字符串。
你这样称呼它:
That says that the best match is a method that takes a string, two output strings, and two other strings.
You are calling it thus:
WhatsAppApi.Register.WhatsRegisterV2.RequestCode(txtPhoneNumber.Text, out password, "sms")
提供一个字符串,一个输出字符串和最终字符串。
文档中有一个与该签名匹配的重载:
Which provides a string, one output string, and a final string.
There is an overload in the documentation which matches that signature:
public static bool RequestCode(string phoneNumber, out string password, string method = "sms", string id = null)
所以我首先检查你是否加载了正确的API版本并且你也是引用正确的版本。
So I'd start by checking you have the right version of the API loaded and that you are also referencing the right version.
这篇关于我应该怎么称呼这种方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!