Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLServiceTypeFacebook setInitialText is not working

I am trying to share a text on Facebook with SLServiceTypeFacebook on IOS 8.3. But the popup text box displayed empty. I want it to be displayed with text in it. Below you can see the code I use for that.

 if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])   {        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];         [controller setInitialText:@"First post from my iPhone app"];        [self presentViewController:controller animated:YES completion:Nil];   } 
like image 202
birdcage Avatar asked Apr 28 '15 17:04

birdcage


2 Answers

It seems to be a problem having installed the latest Facebook app update (v29). Removing it "fixes" the problem.

https://developers.facebook.com/bugs/1632385646995079/ https://developers.facebook.com/bugs/962985360399542/

Update (Jun. 3, 2015)

Well. It seems that the new Facebook policy says that prefilling a message through setInitialText: is a prefill violation.

https://developers.facebook.com/docs/apps/review/prefill

So I guess the only way to share content from now on is the FBSDKShareDialog

https://developers.facebook.com/docs/sharing/ios

like image 53
nnarayann Avatar answered Oct 18 '22 18:10

nnarayann


Gotta love the efficiencies of Facebook. Am a bit late on this but may help someone out.

#import <FBSDKShareKit/FBSDKShareKit.h>  FBSDKShareLinkContent  *content = [[FBSDKShareLinkContent alloc] init]; content.contentURL = self.urlForSocialMedia; content.contentDescription = self.textForFB; content.contentTitle = @"Results.";  [FBSDKShareDialog showFromViewController:self                              withContent:content                                 delegate:self]; 
like image 37
PhillipOReilly Avatar answered Oct 18 '22 16:10

PhillipOReilly