Catalin Craciun
Catalin Craciun

Reputation: 284

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:

What is doesn't work:

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.

Upvotes: 15

Views: 4936

Answers (3)

Max_Power89
Max_Power89

Reputation: 1770

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.

Upvotes: 4

Pau Ballada
Pau Ballada

Reputation: 1628

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.

Upvotes: 14

Rony Cuzco
Rony Cuzco

Reputation: 41

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

Upvotes: 3

Related Questions