Reputation: 68770
I'm writing a simple "FaceBook-This" function to open up a post for the user based on content from my app. What am I missing to get the FaceBook UI up?
public static void FacebookThis (string text)
{
if (SLComposeViewController.IsAvailable (SLServiceKind.Facebook)) {
var service = SLComposeViewController.FromService(SLServiceKind.Facebook);
service.SetInitialText(text);
}
}
Upvotes: 1
Views: 319
Reputation: 13266
You're just missing the PresentViewController()
call, and then dismiss it in the completion handler:
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);
}
}
Upvotes: 1