SLComposeViewController setInitialText is not working if facebook app has installed in the device

SLComposeViewController setInitialText is not working if facebook app has installed in the device. its working if we have used older version of facebook messenger.

Replies

According to facebook new policy prefilling a message through

setInitialText:
is a prefill violation,

please have a look { developers(.)facebook(.)com(/)docs(/)apps(/)review(/)prefill }


As I understand you should use FBSDKShareDialog as per new FB policy.

Before setInitialText add # before this test..Code below..It is working for me



SLComposeViewController *mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];



[mySLComposerSheet setInitialText:@"#myInitialTextIsHere"];

[mySLComposerSheet addURL:[NSURL URLWithString:strURL]];



[mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {



switch (result) {

case SLComposeViewControllerResultCancelled:

NSLog(@"Post Canceled");

break;

case SLComposeViewControllerResultDone:

NSLog(@"Post Sucessful");

break;



default:

break;

}

}];



[self presentViewController:mySLComposerSheet animated:YES completion:nil];