https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
获取手机号接口与文档描述不同The interface for obtaining the mobile phone number is different from the document description
获取手机号接口与文档描述不同框架类型 | 问题类型 | API/组件名称 | 终端类型 | 微信版本 | 基础库版本 |
---|---|---|---|---|---|
小程序 | Bug | getPhoneNumber | 工具 | 1.06.2201240 | 2.22.0 |
Framework type problem type API / component name terminal type wechat version basic library version applet bug getphonenumber tool 1.06.2201240 2.22.0 https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html The code fragment is only the button in the code example to obtain the user's mobile phone number
回答:
① 确认当前基础库版本是否为 2.21.2 及以上。
② 目前开发者工具稳定版未兼容此表现(近期应该会同步)。
③ 正常情况下,基础库 2.21.2
对应的是客户端版本号为 8.0.16
,如果你的版本低于 8.0.16
并且是通过开发者工具向客户端推送的 2.21.2
基础库,大几率不会返回 code
参数,请手动更新微信版本。
目前请先用 开发版 或者 真机 进行调试。
现在可以正确拿到code了。时间点大概在更新客户端的5 6分钟后。
原文出处:获取手机号接口与文档描述不同
把开发工具更新的最新版,code就有了