Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在后台共享到Facebook_Ios_Swift - Fatal编程技术网

Ios 在后台共享到Facebook

Ios 在后台共享到Facebook,ios,swift,Ios,Swift,这是我用来分享给facebook的功能: @IBAction func shareFacebookButton(sender: AnyObject) { if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) { let fbShare:SLComposeViewController = SLComposeViewController(forServiceTyp

这是我用来分享给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
时,会打开一个提示,用户必须在其中按下“Post”。有没有什么方法让用户不必看到“Post”提示?因此,当用户按下shareFacebookButton时,它会在后台与Facebook共享?

没有iOS包装器可以为Facebook提供在后台发布的可能性。Post功能仅在用户参与的情况下工作


这与Twitter不同。你需要在Twitter上注册你的应用程序才能收到消费者密钥和消费者机密。完成后,只需使用此处的代码作为示例:

如果您有其他问题,请提出新问题。请不要更改您现有的问题,因为它会使已给出的答案无效