ShareSDK微信分享踩过的坑

1.分享链接时最后只显示分享了图片原因是下图中如勾选了BypassApproval,则在分享时会绕过微信验证,但是功能不全,只能一图片方式分享图片,所有取消勾线就好了
这里写图片描述

2.分享本地图片是路径权限问题
ios图片放在 StreamingAssets只读文件夹下面,写入下面的代码。

content["image"] = Application.streamingAssetsPath+”/pic.png;

安卓得放在sdcard中才可以,需要在分享前把u3d里的图片拷贝到sdcard卡里面,这也是我看有其他前辈这么摸索出来的。在Resources文件夹下放一个图片,记住一定要PNG,在U3D里面把图片的格式修改成RGBA。

 //读、写的路径        
string imagePath = Application.persistentDataPath + "/pic.png";

//如果文件不存在,把它拷贝进去。
if(!System.IO.File.Exists(imagePath))
{
       Texture2D o =  Resources.Load("pic ") as Texture2D;
       System.IO.File.WriteAllBytes(imagePath, o.EncodeToPNG());
}

这样在分享图片的时候路径就可以直接写了

string imagePath = Application.persistentDataPath + "/ pic.png";

if(System.IO.File.Exists(imagePath))
{
       content["image"] = imagePath;
}

如果你想分享的是一张截屏图片,这样来写


Application.CaptureScreenshot("screen.png");
content["image"] =     Application.persistentDataPath + "/screen.png";

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值