0

This is the function i use to share to facebook:

@IBAction func shareFacebookButton(sender: AnyObject) {
        if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) {
            let fbShare:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)

            fbShare.addURL(NSURL(string: "http://www.url-goes-here.com/"))

            self.presentViewController(fbShare, animated: true, completion: nil)

        } else {
            let alert = UIAlertController(title: "Account Error", message: "You have to be logged in to use this function.", preferredStyle: UIAlertControllerStyle.Alert)

            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
            self.presentViewController(alert, animated: true, completion: nil)
        }
    }

When the user press the shareFacebookButtonit opens up a prompt where the user has to press "Post". Is there any ways that the users dont have to see the "Post" prompt? So when the user press shareFacebookButton it share to Facebook in background?

Paulw11
  • 108,386
  • 14
  • 159
  • 186
Roduck Nickes
  • 1,021
  • 2
  • 15
  • 41
  • If you have a different question, please ask a new question. Please do not change your existing question as it invalidates the answers that have been given – Paulw11 Dec 04 '15 at 01:47

1 Answers1

0

There is no wrapper for iOS which can provide possibility to post in background for Facebook. Post functionality works only with user's participation.

It's different with Twitter. You will need to register your app on Twitter to receive consumer key and consumer secret. After you have it just use the code for example from here: Accessing Twitter Direct Messages using SLRequest iOS

Community
  • 1
  • 1
m.aibin
  • 3,528
  • 4
  • 28
  • 47