SLComposeViewController setInitialText not showing in view

I am trying to use SLComposeViewController to share a link in my iOS application.

SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; [controller setInitialText:@"Here the link I promised:"]; [controller addURL:[NSURL URLWithString:@"http://www.url.com"]]; [self presentViewController:controller animated:YES completion:nil]; 

When the controller shows, there is no text in the input field. You can add text and send it in order (the URL also appears in the message).

I just installed FacebookSDK 4.01 and this is an iOS 7/8 application.

Any ideas on why the source text is not displayed. I even tried to do this without a url and just make the text but nothing.

Additional note . If I remove addURL, the application freezes when I touch "Mail" and the post is never sent.

Thanks for any help !!!

+11
ios facebook slcomposeviewcontroller
Apr 30 '15 at 14:42
source share
2 answers

I found a good way around this, which still gives the user control.

For Facebook only, before the SLComposerViewController submission, I show a dismissal notification (with a hold of 6 seconds if OK was not pressed). This warning will say, "Write to your friends about how you played! \ N \ nYou can just paste PASTE for a pre-configured message."

Immediately after showing a warning, I then use the following to send a pre-configured message to UIPboardboard:

  UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.string = msg; 

So, the SLComposeViewController is presented and a warning is displayed above it. When the user rejects the warning (or skips 6 seconds and dismisses himself), the user can simply PASTE, right in the message body, your pre-configured message. Or not, what a beauty of it.

Hope this helps some others get around what the FB decided to suddenly achieve. I didn’t even understand that it’s against the policy to use the setInitialText method for FB.

Greetings.

+8
May 24 '15 at 21:48
source share

This behavior is intended. See also this error report: https://developers.facebook.com/bugs/962985360399542/ . As @WizKid mentions, he is against politics to pre-populate the text. Until recently, you could still do this (violating the policy), but now it is actually forced.

You cannot do anything for this on your side; this is a political execution of Facebook.

Also related Rdar: http://openradar.appspot.com/20709403

+7
May 4 '15 at 3:54
source share



All Articles