在后台分享到Facebook

时间:2015-12-04 01:08:56

标签: ios swift

这是我用来分享给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)
        }
    }

当用户按下shareFacebookButton时,会打开一个提示,用户必须按“发布”。有没有用户没有看到“发布”提示的方法?那么当用户按shareFacebookButton它在后台分享给Facebook时?

1 个答案:

答案 0 :(得分:0)

没有适用于iOS的包装器可以提供在Facebook后台发布的可能性。发布功能仅适用于用户的参与。

与Twitter不同。您需要在Twitter上注册您的应用程序以接收消费者密钥和消费者密钥。完成后,只需使用代码,例如:Accessing Twitter Direct Messages using SLRequest iOS