The code snippet below is the callback for an on screen button. The Facebook sheet appears but contains no text. However, if you replace SLServiceTypeFacebook
with SLServiceTypeTwitter
it does show the initial text. I am using XCode 6.3.1 and iOS 8.3 on an iPhone 6. Thank you in advance.
-(IBAction)facebookButton:(id)sender
{
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
NSString* facebookText = @"Awesome App";
SLComposeViewController *fbPostSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbPostSheet setInitialText:facebookText];
[self presentViewController:fbPostSheet animated:YES completion:nil];
}
else{
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Unable to Connect to Facebook"
message:@"Make sure your device has an internet connection and you have your Facebook account setup in the Settings App"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}