【问题标题】:Flutter social share plugin(facebook / instagram) not workingFlutter 社交分享插件(facebook / instagram)不起作用
【发布时间】:2020-12-28 07:16:14
【问题描述】:

我正在尝试为我的应用创建分享功能,以将图像/视频分享到 facebook、instagram 等。
所以我为social_share_plugin 0.3.1 + 1(for facebook and instagram)
share 0.6.5 + 4(for etc) 准备了一些插件。
我使用 getTemporaryDirectory() 作为我的颤振应用程序根目录。
当我使用share 仅使用分享按钮时,它适用于 facebook 和 instagram。
但是,social_share_plugin 不能使用相同的参数路径。
我为manifest.xml 实现了一些代码,social_share_plugin 需要什么才能成功工作(还有其他代码)。
但我不明白为什么这不起作用。
这段代码是我的对话分享功能。

switch(shareType) {
    case "SAVE":
        await saveWork(false); //save file to getTemporaryDirectory()
        break;
    case "SHARE":
        Share.shareFiles([widget.file_path]); //this works very well 
        break;
    case "FACEBOOK":
        var permission = await checkPermissions();
        if (permission.isGranted) {
            //this not working with same directory
            await SocialSharePlugin.shareToFeedFacebook(path: widget.file_path).catchError(
                (e) => print("[facebook error]: " + e.toString())
            );
        } else {
            Fluttertoast.showToast(msg: "permission is denied");
        }
        break;
    case "INSTAGRAM":
        var permission = await checkPermissions();
        if (permission.isGranted) {
            //this not working with same directory
            await SocialSharePlugin.shareToFeedInstagram(path: widget.file_path).catchError(
                (e) => print("[insta error]: " + e.toString())
            );
        } else {
            Fluttertoast.showToast(msg: "permission is denied");
        }
        break;
    }

当我点击 Instagram 分享时,分享对话框运行良好。
但在 instagram 应用程序中,吐司消息显示 Unable to load image,当我单击“供稿”分享时返回我的应用程序。
分享给导演和故事节目Unable to share image

此外,即使是 facebook 分享按钮也没有显示对话框。
我的文件路径就像/data/user/0/com.example.app/cache/save/1510196212_2-1609136165662.png

【问题讨论】:

  • 您好,有关此问题的任何更新。我也面临这个问题。我已经在“getTemporaryDirectory()”上创建了 png 文件,但是没有加载这个“social_share”。虽然它正在加载“共享”包。我使用的是“2.0.5”版本。

标签: android facebook flutter instagram socialshare


【解决方案1】:

你能试试这个https://pub.dev/packages/social_share这个插件吗?我正在使用这个插件,对我来说工作正常。

social_share: ^2.0.5

【讨论】:

  • 不支持分享图片或视频吗?似乎只有分享到故事。
猜你喜欢
  • 1970-01-01
  • 2019-06-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-15
相关资源
最近更新 更多