微信公众号添加菜单跳转到小程序的40166错误码解决方案

{"errcode":40166,"errmsg":"invalid weapp appid hint: [evMVGa07191892]"}

 

首先看微信公众号和微信小程序是否关联

其次再看自定义添加菜单中添加小程序的appid是不是原始id,如果是原始id的话要在小程序后台查看小程序id

 

然后检查以上都没问题,因为包的异常是与appid有关的,所以再看创建的自定义菜单给微信返回的json里面是否有appid

一看是这样的

{"button":[{"type":"click","name":"一级","sub_button":[{"type":"miniprogram","name":"小程序","url":"http://www.baidu.com"}]},{"type":"miniprogram","name":"一级2","url":"https:/www.baidu.com"},{"type":"click","name":"一级3","sub_button":[{"type":"miniprogram","name":"小程序","url":"https://www.baidu.com"}]}]}

这样显然不行啊

https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013

文档里说得清清楚楚明明白白,要是miniprogram类型的话要传appid、pagepath

 

所以检查一下是哪里没有赋值,赋值就可以了呀

一步一步检查,重点检查下WxMenuGsonAdapter

{"button":[{"type":"click","name":"一级","sub_button":[{"type":"miniprogram","name":"小程序","url":"http://www.baidu.com","appid":"this is your appid","pagepath":"pages/index/index"}]},{"type":"miniprogram","name":"一级2","url":"https:/www.baidu.com","appid":"this is your appid","pagepath":"pages/index/index"},{"type":"click","name":"一级3","sub_button":[{"type":"miniprogram","name":"小程序","url":"https://www.baidu.com","appid":"this is your appid","pagepath":"pages/index/index"}]}]}

(上面的appid要是小程序的appid而不是原始id,在小程序后台查看就可以了)

 

posted @ 2019-03-14 17:10  HelloWorld1815  阅读(5608)  评论(0编辑  收藏  举报