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.
These are the pod files that I'm using in the project, pod 'Alamofire', '~> 4.5'
pod 'AlamofireImage', '~> 3.0'
pod 'SwiftyJSON'
pod 'RAMAnimatedTabBarController'
pod 'FacebookCore', '0.9.0'
pod 'FacebookLogin', '0.9.0'
pod 'FacebookShare', '0.9.0'
pod 'FBAudienceNetwork'
pod 'GoogleMaps', '~> 3.3.0'
pod 'GooglePlaces', '~> 3.3.0'
pod 'GoogleSignIn'
pod 'Google-Mobile-Ads-SDK'
pod 'SideMenu'
pod "QRCode"
pod 'SwipeMenuViewController', '~> 2.0.0'
pod "ScrollingFollowView"
pod 'DLRadioButton', '~> 1.4'
pod 'AZDialogView'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
pod 'SKActivityIndicatorView', '~> 0.1.0'
pod 'SwiftyGif'
pod 'ImageSlideshow', '~> 1.6'
pod "ImageSlideshow/Alamofire"
pod 'SDWebImage', '~> 4.0'
pod "PhotoSlider"
pod 'lottie-ios'
pod 'CardsLayout'
pod 'Fabric', '~> 1.10.2'
pod 'Crashlytics', '~> 3.13.2'
pod "SkeletonView"
also I'm importing frameworks files in the class,
import ImageSlideshow
import AlamofireImage
import CoreLocation
import FacebookShare
import MessageUI
import SKActivityIndicatorView
import FBSDKShareKit
import FBSDKCoreKit
import MapKit
import GoogleMobileAds
import FBAudienceNetwork
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.
EDIT
In your imports, comment this line:
//import FBSDKShareKit
The FacebookShare
pod already imports it for you. That is the source of the problem.