html52.com
我爱小程序-开发者交流社区

点击按钮后没反映,只限iphone,其他设备都可以

问题模块
API和组件



按钮顶级后,模拟器和android 真机,都可以执行,并跳转,到iphone上点完就卡住不动了


如何能在iphone上调试,并查看到问题原因


调试的时候,弹出的调试信息被遮盖住了, 也看不到具体有什么问题

调试的时候,弹出的调试信息被遮盖住了, 也看不到具体有什么问题


调试的时候,弹出的调试信息被遮盖住了, 也看不到具体有什么问题

网友回复

某人:

wx.canvasToTempFilePath({

          canvasId: id,

          x: x,

          y: y,

          width: width,

          height: height,

          destWidth: width / deviceRadio,

          destHeight: height / deviceRadio,

          success: function success(res) {

            typeof args[args.length - 1] === 'function' && args[args.length - 1](res.tempFilePath);

          },

fail:function(res){

console.log("res" + res);

}

        });

终于定位到问题了, 我在这里生成图片的时候, 失败了, 但是没找到具体的失败原因

某人:

this.wecropper.getCropperImage((avatar) => {



是这段代码没执行, 没找到什么原因, 在 android和模拟器都可以执行

某人:

wx.chooseImage  是没问题的,图片已经选择好了


南山隐者:

你可以看一下是wx.uploadFile报错了还是wx.chooseImage

南山隐者:

你wx.chooseImage怎么写的?


某人:

chooseImage () {

showLoading();

this.wecropper.getCropperImage((avatar) => {

if (avatar) {


//参加活动,上传图片

const uploadTask =wx.uploadFile({

url: Constant.API_URL_MATCH_TASKPART,

filePath: avatar,

name: 'file',

formData: {

'userId': that.data.userId,

'matchId': that.data.matchId

},

success: function (res) {

console.log("type=" + res);

var data = res.data

//do something

cancelLoading();

//改变首页显示数据,隐藏显示参加活动

var pages = getCurrentPages();

var prevPage = pages[pages.length - 2];  //上一个页面

prevPage.setData({

isjoin:true,

});

//跳转到个人详情页面

wx.redirectTo({

url: Constant.PAGE_USERINFO + '?userId=' + that.data.userId + '&matchId=' + that.data.matchId

})


}

})


} else {

console.log('获取图片失败,请稍后重试')

}

})

}


南山隐者:
changeAvatar: function(){
    var that = this
    wx.showActionSheet({
      itemList: ['拍照', '从手机相册选择'],
      success: function(res) {
        that.chooseImage(res.tapIndex)
      },
    })
  },
  chooseImage: function(index){
    var that = this
    var sourceType = ''
    if(index == '0'){
      sourceType = 'camera'
    }else if(index == '1'){
      sourceType = 'album'
    }
    var token = wx.getStorageSync('lgAccessToken')
    wx.chooseImage({
      count: 1,
      sizeType: 'compressed',
      sourceType: [sourceType],
      success: function(res){
        const src = res.tempFilePaths[0]
        console.log(src)
        that.wecropper.pushOrign(src)
        that.setData({
          showCropper: true,
          showResume: false,
          tempFilePaths: res.tempFilePaths
        })
      }
    })
  },

我是这样子写的,都没事。。。

南山隐者:

贴代码看看


某人:

里面写了上传图片的代码,上传成功跳转到其他页面,   android 真机和模拟器都是可以的, 就 iphone 的手机, 点了确定就没反映了


某人:

定义了,  安卓和模拟器都可以

只有iphone 的手机到这就没反映了


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付