1.先申请了服务号,然后在服务号里面建了个小程序,发现在用的时候,没有unionId。
2.秉着遇事有问题就重启的原则,我重启试了n遍,还是不行,请问是我的错吗?
如何获取公众号的unionId和小程序的unionId?How to get the unionId of the official account and the unionId of the mini program?
如何获取公众号的unionId和小程序的unionId?1.先申请了服务号,然后在服务号里面建了个小程序,发现在用的时候,没有unionId。
2.秉着遇事有问题就重启的原则,我重启试了n遍,还是不行,请问是我的错吗?
1. First apply for the service number, and then create a small program in the service number. It is found that there is no unionid when using it. 2. According to the principle of restarting when there is a problem, I have tried to restart it n times, but it still can't. is it my fault?
回答:
1、注册个微信开放平台账号https://open.weixin.qq.com/ 并且把你的公众号和小程序都绑定进去
2、注意unionid的下发触发机制,只有用户进入你第二个同主体的应用时,才会带上unionid。简单来说在你绑定好开放平台以后,用户先关注公众号是没有unionid的,当他再进入小程序时,才会带着unionid。
需要绑定在开放平台下才可以,而且unionid是开放平台的唯一标识并不是小程序和公众号的。