按钮顶级后,模拟器和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);
}
});
终于定位到问题了, 我在这里生成图片的时候, 失败了, 但是没找到具体的失败原因
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 }) } }) }, |
我是这样子写的,都没事。。。
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(‘获取图片失败,请稍后重试’)
}
})
}