Windows Store App,...无法在当前平台上使用。错误

时间:2014-07-12 22:28:14

标签: c# facebook windows-store-apps facebook-graph-api-v2.0

我有Windows Store应用程序,这实际上是一款游戏,我试图在Facebook上实现发布结果。 我从facebooksdk.net使用Facebook SDK for .Net

这是我的代码

        FacebookSession session = await App.FacebookSessionClient.LoginAsync("publish_stream");
        if (session == null)
        {
            MessageDialog dialog = new MessageDialog("Error while getting publishing permissions. Please try again.");
            await dialog.ShowAsync();
            return;
        }

        // refresh your access token to contain the publish permissions
        App.AccessToken = session.AccessToken;

        FacebookClient fb = new FacebookClient(App.AccessToken);

        string message = "Your score is: " + points;
        dynamic proba = message;
        try
        {
            //The next line throws exception
            dynamic fbPostTaskResult = await fb.PostTaskAsync("/me/feed?message='{0}", proba);
            var result = (IDictionary<string, object>)fbPostTaskResult;

            var successMessageDialog = new Windows.UI.Popups.MessageDialog("Posted Open Graph Action, id: " + (string)result["id"]);
            await successMessageDialog.ShowAsync();
        }

        catch (Exception ex)
        {
            MessageDialog exceptionMessageDialog = new MessageDialog("Exception during post: " + ex.Message);
            exceptionMessageDialog.ShowAsync();
        }

我收到的例外消息是:

  

API&#39; System.String.Get_FirstChar()&#39;不能在当前平台上使用。有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=248273

我尝试了不同的方法将参数发送到&#34; PostTaskAsync()&#34;方法,但我总是得到相同的例外。搜索Google和Stackoverflow并没有多大帮助。 我非常感谢任何帮助。 干杯

0 个答案:

没有答案