2
我想學習使用tweetinvi
將C#連接到Twitter。C#tweetinvi代碼408
我沒有問題,而與Twitter Key
和Twitter Token
連接,然後調試我的代碼,發現在User.GetAuthenticatedUser()
null
值不過,我已經委託我自己的Twitter帳戶的Twitter的應用服務。爲什麼User.GetAuthenticatedUser()
返回Null
值?
如何解決這個下面的圖片?
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;
using Tweetinvi;
namespace Twitdesk
{
public partial class Form1 : Form
{
Cl_Tweetinvi twitinvi;
Command cmd = new Command();
public Form1()
{
InitializeComponent();
twitinvi = new Cl_Tweetinvi();
var AuthenticatedUser = User.GetAuthenticatedUser();
if(AuthenticatedUser == null)
{
var latestException = ExceptionHandler.GetLastException();
MessageBox.Show(latestException.ToString());
Application.Exit();
}
else
{
var settings = AuthenticatedUser.GetAccountSettings();
}
var tweets = Timeline.GetHomeTimeline();
this.Text = cmd.title;
MessageBox.Show("done");
}
}
}
嗨,我做了一些更新,你的代碼已經寫好了。我想知道爲什麼'AuthenticatedUser'變成'null' – Cignitor
現在它工作嗎? – Linvi
nope,我不知道爲什麼'AuthenticatedUser'返回'Null',因爲有我自己的Twitter帳戶使用我的twitter應用程序。 – Cignitor