getLocalImgData的调用失败,是测试号权限问题或者其他原因引起的吗?
发布于 6 年前 作者 yanghan 9730 次浏览 来自 官方Issues

先上代码:

wx.chooseImage({
count: count, // 微信默认9
   sizeType: ['original', 'compressed'],
   sourceType: ['album', 'camera'],
   async: false,
   success: function (res) {
medil_id = "";
       localIds.arr = res.localIds;
       if (window.__wxjs_is_wkwebview){
for (var i = 0; i < localIds.arr.length; i++){
wx.getLocalImgData({
localId:localIds.arr[i],
                   success: function (result){
var localData = result.localData; // localData是图片的base64数据,可以用img标签显示
                       localData = localData.replace('jgp', 'jpeg');//iOS 系统里面得到的数据,类型为 image/jgp,因此需要替换一下
                       localDatas.arr.push(result.localData);
                       //console.log("for循环打印"+localData);
                   },
                   fail: function (result) {
console.log("失败的原因" + result);
                   }
});
           }
}

进入for循环之后,wx.getLocalImgData接口并没有正确执行(我认为是根本没被调用,没有在控制台打印出任何东西),看到有人可能是测试号的权限问题,不知道应该如何解决

1 回复

请问楼主解决问题了吗?

回到顶部