Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLComposeViewController won't set initialText for SLServiceTypeFacebook

It seems as a bug in Social framework, it won't set the initial text for Facebook service type. This is my implementation using Swift:

let view = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
if view.setInitialText("Some text") {
    NSLog("Success")
} else {
    NSLog("Failure")
}
view.addURL(NSURL(string: "https://google.ro"))
self.presentViewController(view, animated: true, completion: nil)

What it works:

  • The URL shows up for both, Facebook, and Twitter
  • The initialText works correctly just for Twitter

What is doesn't work:

  • The initialText won't show up for Facebook, even though the code above outputs "Success"

Update 2

It seems like Facebook really doesn't want developers to set the initial text of a message when Sharing as that it's impossible even with their SDK. In the app I was implementing I've chosen screenshots from the app (uploaded as images) for letting the user share their progress on Facebook.

Update

The solution is to use the Facebook SDK for iOS, that feature of Social framework is not supported by Facebook anymore.

like image 647
Catalin Craciun Avatar asked Apr 25 '15 20:04

Catalin Craciun


3 Answers

Not a bug, Facebook doesn't allow it anymore.

Use of the iOS share sheet is subject to Facebook Platform Policy, including section 2.3 which states that apps may not pre-fill. In the context of the share sheet, this means apps may not pre-fill the share sheet's initialText field with content that wasn't entered by people earlier in their use of the app.

like image 95
Pau Ballada Avatar answered Nov 11 '22 12:11

Pau Ballada


Facebook dose't allow to pre fill message anymore. For more info here

Saying that, if you use native Facebook sdk it won't solve your problem, because Facebook will not publish your app. So as written on Facebook guidelines, the only solutions that you have are:

  1. Populate the user message parameter with content that the user manually entered earlier in your app's flow.
  2. Your app’s composer can include a call-to-action that disappears when people start to write a post. For example, Facebook's composer uses grey scale text to ask “What's on your mind?” that disappears when people start to write.
like image 4
Max_Power89 Avatar answered Nov 11 '22 13:11

Max_Power89


I think it is an iOs 8.3 bug. Before I updated to that version it was working correctly. :-(

like image 3
Rony Cuzco Avatar answered Nov 11 '22 12:11

Rony Cuzco