我使用以下代码连接到 firebase 并尝试读取数据。连接成功,但我无法读取数据。它给出 System.NullReferenceException:'对象引用未设置为对象的实例。
namespace GPSTrack
{
public partial class Form1 : Form
{
IFirebaseConfig config = new FirebaseConfig
{
AuthSecret = "4xxxxxxxxxxxxxxxxEzs",
BasePath= "nodxxxxxx.firebaseio.com"
};
IFirebaseClient client;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
client = new FireSharp.FirebaseClient(config);
if(client!=null)
{
MessageBox.Show("Connection success");
}
}
private async void button1_Click(object sender, EventArgs e)
{
FirebaseResponse response = await client.GetTaskAsync("test");
FBclass obj = response.ResultAs<FBclass>();
MessageBox.Show(response.ToString());
}
}
}