1

アプリのコンテンツに基づいてユーザーの投稿を開くための簡単な「FaceBook-This」関数を作成しています。FaceBook UIを起動するために何が欠けていますか?

  public static void FacebookThis (string text)
  {
     if (SLComposeViewController.IsAvailable (SLServiceKind.Facebook)) {
        var service = SLComposeViewController.FromService(SLServiceKind.Facebook);
        service.SetInitialText(text);
     }
  }
4

1 に答える 1

1

呼び出しが欠落しているだけPresentViewController()で、完了ハンドラーでそれを閉じます。

public static void FacebookThis (string text)
{
    if (SLComposeViewController.IsAvailable (SLServiceKind.Facebook)) {
        var service = SLComposeViewController.FromService(SLServiceKind.Facebook);
        service.SetInitialText(text);
        service.CompletionHandler += (result) => {
            DismissViewController(true, null);
        }
        PresentViewController(service, true, null);
    }
}
于 2012-11-19T06:04:28.430 に答える