【问题标题】:Firebase storage with Ionic 2 SocialSharing plugin带有 Ionic 2 SocialSharing 插件的 Firebase 存储
【发布时间】:2017-04-22 13:50:45
【问题描述】:

我的图像存储在 Firebase 存储中。我注意到,如果我将图像存储在一个文件夹中,我将无法再将它与来自 ionic native 的 SocialSharing plugin 一起使用。

有人找到解决方法了吗?

whatsappShare() {

        let image = "https://firebasestorage.googleapis.com/v0/b/instagram-test-fe4a8.appspot.com/o/000.jpg?alt=media&token=64dd92cd-27c2-4c36-9c1d-2ab376ffd16c"  //This is working
        //let image = "https://firebasestorage.googleapis.com/v0/b/instagram-test-fe4a8.appspot.com/o/test%2F000.jpg?alt=media&token=2bc49648-cf1c-41fe-8e1f-071d54f56402"  //This is failing because stored in test/ folder

        //shareViaWhatsApp(message, image, url) 
        SocialSharing.shareViaWhatsApp("Checkout this picture!", image, "lycos.com/")
            .then( () => {
                    alert("WhatsApp Success");
                }, () => {
                    alert("WhatsApp failed")
                })
    }

我找到了这个似乎相关的 github https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues/696

这意味着该插件可以在iOS中运行而在android中失败? 有什么可能的解决办法吗?

【问题讨论】:

  • 寻找答案花了大约 3 个小时。似乎是一个老问题(5-6 个月)。我什么都没找到。无论如何,感谢您提出“无文件夹”解决方案。

标签: firebase ionic-framework ionic2 cordova-plugins firebase-storage


【解决方案1】:

是的。最后,我找到了一种将 Firebase Storage 中的图像共享到任何服务的方法。只需满足以下两个条件:

  1. 将图像从 uri 转换为 base64 字符串。您可以在那里找到大量这种转换的示例。
  2. 使用 shareWithOptions() 发送图像数据。其他方法似乎不适用于以这种方式编码的图像数据。

我对有关此问题的任何其他更新感兴趣。希望对任何人都有帮助。

【讨论】:

  • 正是我的问题兄弟...您如何设法将 url 转换为 base64?
  • thxx @Becario Senior 的链接..是的,最后我最终将它存储为 base64 字符串
猜你喜欢
  • 2018-10-25
  • 1970-01-01
  • 2016-12-03
  • 1970-01-01
  • 2019-09-03
  • 1970-01-01
  • 2016-08-19
  • 2017-05-16
  • 2018-08-10
相关资源
最近更新 更多