SLServiceTypeFacebook 'deprecated in iOS 11.0

I am working on a project in xcode 9 and one of my previous codes, warning that the code is deprecated where it does not trigger an action. The code is below. 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) } 
+2
ios xcode swift ios11 swift4
source share
1 answer

The settings for Facebook , Twitter and other applications have been deleted in the Settings application.

Now applications will be processed like other applications using 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 a third-party SDK for individual sharing.

Facebook Sharing Doc

Twitter Sharing Doc

+3
source share

All Articles