简体   繁体   中英

Redundant conformance of 'ViewController' to protocol 'SharingDelegate' after updating the FBSDKCore to 5.6.0 in iOS Swift

Currently I'm working on an iOS application in swift. In my application I'm using FacebookShare pods(FBSDKCoreKit 4.46.0) for sharing contents to the Facebook. For that I was used FBSDKSharingDelegate. Today I updated the pod to FBSDKCoreKit to 5.6.0. After updating I got some suggestion in my code like

'FBSDKSharingDelegate' has been renamed to 'SharingDelegate'

So I changed it to SharingDelegate, also I changed in my code. But now its showing another error,

Redundant conformance of 'ProductDetailViewController' to protocol 'SharingDelegate'

I searched in google, and I didn't get any solution. Please help me.

These are the protocols I'm used in that ViewController class

class customViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, MFMailComposeViewControllerDelegate, UIGestureRecognizerDelegate, UITextViewDelegate, UIScrollViewDelegate, GADBannerViewDelegate, SharingDelegate 
{

}

I don't know which protocol is redundant with SharingDelegate.

According Facebook Documentation , SharingDelegate protocol in it's current version has only three functions:

func sharer(_ sharer: Sharing, didCompleteWithResults results: [String : Any]) {

}

func sharer(_ sharer: Sharing, didFailWithError error: Error) {

}

func sharerDidCancel(_ sharer: Sharing) {

}

None of your other protocols override any of those functions, so your issue doesn't happen here.

You probably has an extension that also implements this protocol, I could reproduce the error like this:

class FBTestViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, MFMailComposeViewControllerDelegate, UIGestureRecognizerDelegate, UITextViewDelegate, UIScrollViewDelegate, GADBannerViewDelegate, SharingDelegate {

}

extension UIViewController: SharingDelegate {

}

Output:

Redundant conformance of 'FBTestViewController' to protocol 'SharingDelegate'

Search your project for those SharingDelegate implementations (probably in extensions) and remove them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM