uni-app 打开小程序报错 invalid_app
uni-app 打开小程序报错 invalid_app
项目信息 | 详情 |
---|---|
产品分类 | uniapp/App |
PC开发环境操作系统 | Windows |
PC开发环境操作系统版本号 | windows11 |
HBuilderX类型 | 正式 |
HBuilderX版本号 | 4.13 |
手机系统 | Android |
手机系统版本号 | Android 14 |
手机厂商 | 华为 |
手机机型 | x40 |
页面类型 | vue |
vue版本 | vue2 |
打包方式 | 云端 |
项目创建方式 | HBuilderX |
示例代码:
uni.share({
title: that.goods.name,
type: "5",
provider: "weixin", //分享服务提供商
scene: "WXSceneSession", //场景
summary: "", //分享内容的摘要
imageUrl: that?.goods?.info?.share_image,
miniProgram: {
id: "gh_430f0641948b",
path:
"/pages/mall/goods_detail/goods_detail?inviteId=" +
that.userinfo.id +
"&goodsId=" +
that.goodsId,
type: 0,
webUrl:
"https://www.feishu.cn/invite/06eWjzncH7nC1?join=1&team_name=%E4%BA%94%E7%BB%B4%E5%85%B1%E7%94%9F",
}, //分享小程序必要参数
success: res => {
console.log(res, "success");
resolve();
},
fail: res => {
console.log(res, "ree");
reject();
},
});
plus.share.getServices(
res => {
let sweixin = res.find(i => i.id === "weixin");
if (sweixin) {
sweixin.launchMiniProgram(
{
id: "gh_430f0641948b",
path: `pages/pay/pay?orderInfo=${encodeURIComponent(
JSON.stringify(that.orderInfo)
)}&&type=${this.type}&&share='app'`,
//测试环境用1 打包后正式环境用0
type: process.env.NODE_ENV === "development" ? 1 : 0,
webUrl: "http://www.dcloud.io/",
},
res => {
console.log(res, "跳转小程序");
},
error => {
console.log(error, "跳转小程序失败");
}
);
} else {
that.$ui.showModal({
title: "提示",
content: "请先安装微信客户端",
showCancel: false,
});
}
},
error => {
console.log(error);
that.$ui.showModal({
title: "提示",
content: "请先安装微信客户端",
showCancel: false,
});
}
);
bug描述:
app 打开小程序报错 回调显示打开成功 返回空 界面显示 invalid_app 分享报不支持的类型(同一套代码 小程序可以分享)
更多关于uni-app 打开小程序报错 invalid_app的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
微信开放平台存在缓存的问题 将移动应用删除重新发布就好了
更多关于uni-app 打开小程序报错 invalid_app的实战教程也可以访问 https://www.itying.com/category-93-b0.html
在 uni-app 中打开小程序时,如果遇到 invalid_app
错误,通常是因为小程序的 AppID 配置不正确或者缺少必要的配置。以下是一些可能的原因和解决方法:
1. 检查 AppID 配置
- 确保在小程序项目的
manifest.json
文件中正确配置了 AppID。 - 在
manifest.json
文件中,找到mp-weixin
或mp-alipay
等平台配置项,检查appid
是否正确。
"mp-weixin": {
"appid": "your_wechat_appid"
}
- 如果 AppID 配置错误或缺失,会导致
invalid_app
错误。
2. 检查小程序平台配置
- 如果你使用的是微信小程序开发工具,确保在微信开发者工具中正确配置了 AppID。
- 在微信开发者工具中,打开项目后,点击右上角的“详情”按钮,检查“基本信息”中的 AppID 是否正确。
3. 检查小程序是否已注册
- 确保你在微信公众平台或支付宝开放平台上已经注册了小程序,并且 AppID 是正确的。
- 如果小程序未注册或 AppID 错误,也会导致
invalid_app
错误。
4. 检查 uni-app 版本
-
确保你使用的 uni-app 版本是最新的,旧版本可能存在一些兼容性问题。
-
可以通过以下命令更新 uni-app:
npm install -g @vue/cli @vue/cli-service-global npm install -g @dcloudio/uni-cli