I have following code:
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){ if (result == SLComposeViewControllerResultCancelled) NSLog(@"Cancelled"); else NSLog(@"Done"); [controller dismissViewControllerAnimated:YES completion:Nil]; }; controller.completionHandler = myBlock; [controller setInitialText:@"blah blah"]; [self presentViewController:controller animated:YES completion:Nil];
I have tried across > iOS versions 8.x, however, i found only on iOS 9.1, the Post
button is greyed and text field is empty, while in newer iOS version 9.3.1 isn't.
Anyone has idea? i suspect because of this:
plugin com.apple.share.Facebook.post invalidated
which lead me to link and found that Facebook's policy doesn't allow pre-filled text, but why in iOS 9.3.1 works.
Update: Post button is enabled again after I type some text on the text field.
1 Answers
Answers 1
try this code if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) { let twitterComposeVC = SLComposeViewController(forServiceType: SLServiceTypeFacebook) twitterComposeVC.setInitialText(messagge) twitterComposeVC.addURL(NSURL.init(string: url))
fromController.presentViewController(twitterComposeVC, animated: true, completion: nil) } else { print("No twitter account is configured in settings."); }
0 comments:
Post a Comment