xcode SLServiceTypeFacebook' 在 iOS 11.0 中被弃用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47053446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SLServiceTypeFacebook' was deprecated in iOS 11.0
提问by danu
I'm working on a project in xcode 9 and one of my previous codes giving a warning saying the code is been deprecated, where it does not trigger the action. The code as bellow. How can i overcome this ?
我正在 xcode 9 中处理一个项目,我之前的一个代码发出警告说代码已被弃用,它不会触发操作。代码如下。我怎样才能克服这个?
@IBAction func shareOnFacebookButtonPressed(_ sender: Any) {
let shareToFacebook : SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
shareToFacebook.add(UIImage(named:"pureLightSocial"))
self.present(shareToFacebook, animated: true, completion: nil)
}
回答by Harshal Valanda
The Facebook, Twitter, and Other apps options have been removed in the Settingsapp.
的Facebook,Twitter和其他应用程序选项已经在删除Settings应用程序。
That apps will now be treated like other apps, using the iOS sharing extensions
该应用程序现在将被视为其他应用程序,使用 iOS sharing extensions
let share = [image, text, url]
let activityViewController = UIActivityViewController(activityItems: share, applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
self.present(activityViewController, animated: true, completion: nil)
You can also use third party SDKfor individual sharing
您也可以使用第三方SDK进行个人共享

