调起系统分享组件分享图片。
注意
insight.open.customShare 自 SDK 版本 1.4.3,iOS 客户端 5.4.910 及以上版本支持,Android 客户端与 PC 客户端暂不支持。
insight.open.customShare(options).then().catch()
| 名称 | 类型 | 必填 | 描述 | 最低版本(SDK/APP) |
|---|---|---|---|---|
| imageUrl | String | 是 | 分享的图片地址 | |
| title | String | 否 | 分享标题 | 1.4.4 / 5.5.272 |
错误码说明
| code | msg |
|---|---|
| 2005 | 分享内容为空 |
| 2006 | 分享内容不支持 |
| 2007 | schemaurl fail |
| 2008 | 应用未安装 |
| 2009 | 取消操作 |
| 2010 | 网络异常 ,图片需要转换到本地过程可能失败 |
<button id="customShare">customShare</button>
<script>
document.getElementById("customShare").addEventListener('click', function(e) {
var imageUrl = 'a.png'
insight.open.customShare(imageUrl)
.then(data => {
alert(JSON.stringify(data));
})
.catch(error => {
alert(JSON.stringify(error));
})
}, false);
</script>