Flutter share facebook : 'init()' 已在此处明确标记为不可用 (FBSDKShareKit.ShareDialog)

Flutter share facebook : 'init()' has been explicitly marked unavailable here (FBSDKShareKit.ShareDialog)

我想将我的 flutter 应用程序中的帖子分享到 facebook 等社交媒体平台。

我使用了 flutter_share_me 包(版本 1.2.0), 我的 Android 项目在 Facebook 分享方面运行良好。

但是当我构建我的iOS项目时,由于以下错误导致构建失败

在 SwiftFlutterShareMePlugin.swift 文件的 sharefacebook 功能中。

'init()' has been explicitly marked unavailable here (FBSDKShareKit.ShareDialog)

func sharefacebook(message:Dictionary<String,Any>, result: @escaping FlutterResult)  {
    let viewController = UIApplication.shared.delegate?.window??.rootViewController
    let shareDialog=ShareDialog() // **this line make the error**
    let shareContent = ShareLinkContent()
    shareContent.contentURL = URL.init(string: message["url"] as! String)!
    shareContent.quote = message["msg"] as? String
    shareDialog.mode = .automatic
    ShareDialog(fromViewController: viewController, content: shareContent, delegate: self).show()
    result("Sucess")

}

请帮我解决这个问题。

我发现其他的Flutter开发者也在满足similar issues when they try to share their posts to Facebook using other packages like share_plus包。

https://github.com/fluttercommunity/plus_plugins/issues/579

我已经更新 SwiftFlutterShareMePlugin.swift 的 flutter_share_me 包(版本 1.2.0)文件如下,iOS 项目正在为 facebook 共享工作。

func sharefacebook(message:Dictionary<String,Any>, result: @escaping FlutterResult)  {
    let viewController = UIApplication.shared.delegate?.window??.rootViewController
    
    let shareContent = ShareLinkContent()
    shareContent.contentURL = URL.init(string: message["url"] as! String)!
    shareContent.quote = message["msg"] as? String
    ShareDialog(viewController: viewController, content: shareContent, delegate: self).show()
    result("Sucess")
    
}

我认为问题是因为FBSDKShareKit的一些功能被它的版本升级了。