android - Cordova 应用程序 IOS 中的社交共享
问题描述
我正在尝试通过使用此插件在微信和 WhatsApp 中分享图像:EddyVerbruggen/SocialSharing-PhoneGap-Plugin
window.plugins.socialsharing.shareVia('whatsapp','msg',null,
'images/hello.png' , null /* url */, function(e) {
console.log('share' +e)
}, function(errormsg){
alert(errormsg)
})
window.plugins.socialsharing.shareVia('com.tencent.mm','msg',null,
'images/hello.png' , null /* url */, function(e) {
console.log('share' +e)
}, function(errormsg){
alert(errormsg)
})
我的应用程序在 ios 中崩溃,但在 android 中运行正常。
通过使用另一种方法 shareViaWhatsapp:
window.plugins.socialsharing.shareViaWhatsApp('Message via WhatsApp'
,'images/hello.png', function() {
console.log('share ok')
}, function(errormsg){
alert(errormsg)
})
此方法在 android 中有效,但在 ios 中显示当我共享图像时要共享的所有应用程序,如果我只共享消息它在 ios 中正常工作。请指导我。
解决方案
在我的情况下,我可以确认,使用 shareViaWhatsApp 与 WhatsApp 共享不适用于 iO。我能够共享图片的唯一方法是使用您提到的插件的共享表。所以它是这样的:
this.socialSharing.share(null, null, this.screen, null).then(() => {
console.log(' succ share test')
this.shareWhatsApp()
}).catch((e) => {
console.log(' err share test')
this.shareWhatsApp()
});
推荐阅读
- google-sheets - 无法使用 countifs importrange 功能在 Google 工作表中获取数据
- node.js - 如何在电子应用程序中路径到图像文件?
- android - Android Json 解析与改造
- python - 如何从列表中删除 x 个相同元素的多个实例?
- javascript - 如何使用地图在本机反应中过滤和添加来自json本地文件的数据的条件语句
- python - 各种列表连接方法及其性能
- unity3d - 动画似乎统一覆盖元素位置
- haskell - 检查函数是否在 Haskell 中返回错误
- javascript - 如何传递参数信息异步队列饱和或不饱和?
- python-2.7 - 使用pyyaml读取目录中的多个文件