iOS 11.0中已弃用SLServiceTypeFacebook' [英] SLServiceTypeFacebook' was deprecated in iOS 11.0
本文介绍了iOS 11.0中已弃用SLServiceTypeFacebook'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用xcode 9和以前的代码之一进行警告,警告说该代码已被弃用,并且不会触发该操作.该代码如下.我该如何克服呢?
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 ?
@IBAction func shareOnFacebookButtonPressed(_ sender: Any) {
let shareToFacebook : SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
shareToFacebook.add(UIImage(named:"pureLightSocial"))
self.present(shareToFacebook, animated: true, completion: nil)
}
推荐答案
Settings
应用中的Facebook
,Twitter
和其他应用选项已被删除.
The Facebook
, Twitter
, and Other apps options have been removed in the Settings
app.
现在可以使用iOS sharing extensions
That apps will now be treated like other apps, using the 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)
您还可以使用第三方SDK
进行个人共享
You can also use third party SDK
for individual sharing
这篇关于iOS 11.0中已弃用SLServiceTypeFacebook'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文