In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "how to achieve getUserInfo callback by WeChat Mini Programs". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to achieve getUserInfo callback by WeChat Mini Programs" can help you solve your doubts.
GetUserInfo calls multiple times:
For wx.getUserInfo, many developers have used it to obtain basic user information, provided that user authorization is required. If the user has not previously authorized it, a prompt box pops up as follows:
After clicking allow, we can get the user information, and then carry out a series of operations. It all looked so good, but in one run, after the authorization was allowed, the program didn't go down as we expected. It turns out that the wx.getUserInfo method was called once elsewhere, and only one of the successful authorization callbacks was performed. Suppose it is the following code:
Conclusion:
1. If the user is authorized: A B C will be printed.
two。 Unauthorized users: after clicking allow, one of the three A B C will be printed at random.
Of course, it's best not to call the wx.getUserInfo method in multiple places at the same time, or it will be a headache to encounter this problem. My view on this problem is that multiple calls to the getUserInfo method will only result in an instance of a pop-up window, so it's normal to execute a callback only once when you click allow, but it's strange to execute one of the methods randomly.
Solution:
1. It is rare to call the wx.getUserInfo method at the same time if it is not called at the same time.
two。 Encapsulate a getUserInfo method, store the incoming callback method in an array, and clear the array after traversing the call in the successful / failed callback of authorization.
After reading this, the article "how to achieve getUserInfo callback by WeChat Mini Programs" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.