報錯信息:chooseAddress:fail the api need to be declared in the requiredPrivateInfos field in app.json/ext.json。
這是因?yàn)?code>chooseAddress函數(shù)需要在app.json
或ext.json
中聲明為requiredPrivateInfos
字段的一部分。
官方解釋的網(wǎng)址:地理位置接口新增與相關(guān)流程調(diào)整 | 微信開放社區(qū)
總的一句就是在?2022 年 7 月 14 日后開發(fā)的小程序,需要配置?requiredPrivateInfos
解決方式:
如果在 微信開發(fā)者工具 中,需要在app.json文件中加上配置:
"requiredPrivateInfos": ["chooseAddress"]
?在其他開發(fā)工具如HBuilderX?的話,需要在?manifest.json 的 源碼視圖 中添加如下:文章來源:http://www.zghlxwxcb.cn/news/detail-745838.html
"requiredPrivateInfos": ["chooseAddress"]
如果想一次性配置,可以添加成文章來源地址http://www.zghlxwxcb.cn/news/detail-745838.html
"requiredPrivateInfos": ["getFuzzylocation","getLocation", "onLocationChange","chooseLocation", "chooseAddress","choosePoi","startLocationUpdate","startLocationUpdateBackground"]
到了這里,關(guān)于小程序報錯篇:chooseAddress:fail the api need to be declared in the requiredPrivateInfos field in app.json的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!