Home > Article > WeChat Applet > Some summary of WeChat applet development BUG experience
Small program development is becoming more and more popular, and various bugs are encountered during development. Here we summarize some pitfalls that are easier to fall into and share them with everyone.
1. New Date cross-platform compatibility issues
Using new Date(“2018-05-30 00:00:00”)# in Andriod ##There is a problem with the wood, but it cannot be recognized under ios.
2018/05/30 00:00:00 format. You can use regular expressions to replace strings and replace dashes with slashes.
var iosDate= date.replace(/-/g, '/');.
2. Issues with wx.getUserInfo() interface change
One of the most criticized changes in the WeChat applet recently is that users use wx.getUserInfo (development and trial version), the authorization will not pop up, and the official version will not be affected. The current authorization method requires users to click on an authorization button, and then the authorization pops up.3. Only in debug mode can you send data to your official server
In fact, as long as you pay attention to configuring the legal domain name, this problem will be solved. Sometimes, because we are developing right from the start, we forget to configure the domain name. Later, I found that the data could not be exported. Maybe I forgot to configure it after thinking about it for a long time!4. The problem of not being able to obtain the UnionID
Login must meet two conditions to obtain the UID:5. wx.getSystemInfoSync obtains windowHeight incorrectly
The main reason is that the acquisition is timing, wx.getSystemInfoSync is calculated when the page is initialized, basically can be understood as the screen height. Therefore, the best way is to use an asynchronous interface and call it in the onReady function.onReady() { wx.getSystemInfo({ success({windowHeight}) { // todo } }); }
6. For the local resource name of the image, try to use lowercase naming.
When solving the problem of iPhone X adaptation, when using the image in the redundant part at the bottom<image class='iphonexImg' src="/imgs/iphoneBGT.png" mode="aspectFill">The path is
src='imgs/iphoneBGT.png'
<image class='iphonexImg' src="/imgs/iphonex.png" mode="aspectFill">Written at the end: There are always various bugs in the code, and problems like the ones listed above can still be discovered during development. And after the code goes online, testing cannot guarantee 100% that there are no problems. Here, I recommend Fundebug’s
WeChat applet BUG monitoring service to all of you!
About FundebugFundebug focuses on JavaScript, WeChat mini-programs, WeChat mini-games, Alipay mini-programs, React Native, Node.js and Java real-time BUG monitoring. Since its official launch on Double Eleven in 2016, Fundebug has handled a total of 700 million error events and has been recognized by many well-known users such as Google, 360, Kingsoft, and Baixing.com. Welcome to free trial! Recommended tutorial: "WeChat Mini Program"
The above is the detailed content of Some summary of WeChat applet development BUG experience. For more information, please follow other related articles on the PHP Chinese website!