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 回答