目前我正在从Windows Phone的共享功能。的Windows Phone 7:如何发布鸣叫叽叽喳喳
我的目的是从我的Windows Phone应用程序共享用户到Facebook和Twitter的状态。
我完成了Facebook的成功分享,现在我米试图共享状态(120个字只鸣叫)到Twitter。
我完成使用this Twitter帐户的身份验证。
当我尝试鸣叫张贴在使用这条推按钮单击事件的帐户我登录后,Twitter帐户,
private void btnPostTweet_Click(object sender, RoutedEventArgs e)
{
var credentials = new OAuthCredentials
{
Type = OAuthType.ProtectedResource,
SignatureMethod = OAuthSignatureMethod.HmacSha1,
ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
ConsumerKey = AppSettings.consumerKey,
ConsumerSecret = AppSettings.consumerKeySecret,
Token = this.accessToken,
TokenSecret = this.accessTokenSecret,
Version = "1.1"
};
var restClient = new RestClient
{
Authority = "https://api.twitter.com",
HasElevatedPermissions = true
};
var restRequest = new RestRequest
{
Credentials = credentials,
Path = "/1.1/statuses/update.json",
Method = WebMethod.Post
};
restRequest.AddParameter("status", Uri.EscapeDataString(txtTweetContent.Text));
restClient.BeginRequest(restRequest, new RestCallback(PostTweetRequestCallback));
}
而且回调,
private void PostTweetRequestCallback(RestRequest request, RestResponse response, object obj)
{
string str = response.ToString();
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
if (response.StatusCode == HttpStatusCode.OK)
{
MessageBox.Show(AppSettings.TWEET_POSTED_SUCCESSFULLY);
}
else if (response.StatusCode == HttpStatusCode.Forbidden)
{
MessageBox.Show(AppSettings.TWEET_POST_ERR_UPDATE_LIMIT);
}
else
{
MessageBox.Show(AppSettings.TWEET_POST_ERR_FAILED);
}
txtTweetContent.Text = "";
});
}
它给了我错误为
"Bad Authentication data", Code="215"
我已经成功地将我的应用程序注册到twitter开发者accoun t并在进行此调用之前收到访问令牌密钥。
嗨@Nikhil生主..你如何解决你的问题。我也在努力从twitter获取用户详细信息。你能帮我解决我的问题吗? [我的问题](http://stackoverflow.com/questions/25762349/twitter-integration-in-windows-phone-7)..请你需要帮助。 – Vijay
嗨@Vijay ..你在模拟器或设备上尝试过吗? –
仅限仿真器。我没有设备。它现在在Emulator中工作正常。我们在设备上运行时是否有任何问题? – Vijay