VM4174:1 thirdScriptError
errCode: -1 | errMsg: Cloud API isn't enabled, please call wx.cloud.init first
请先调用 wx.cloud.init() 完成初始化后再调用其他云 API。init 方法可传入一个对象用于设置默认配置,详见文档。;at "pages/home/home" page lifeCycleMethod onLoad function
Error: errCode: -1 | errMsg: Cloud API isn't enabled, please call wx.cloud.init first
请先调用 wx.cloud.init() 完成初始化后再调用其他云 API。init 方法可传入一个对象用于设置默认配置,详见文档。
at new t (http://127.0.0.1:12631/appservice/__dev__/WAService.js:22:14994)
at Object.exportAPI.(anonymous function) [as callFunction] (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:15330)
at c.getOPenid (http://127.0.0.1:12631/appservice/pages/home/home.js:79:12)
at c.onLoad (http://127.0.0.1:12631/appservice/pages/home/home.js:33:8)
at c.<anonymous> (http://127.0.0.1:12631/appservice/__dev__/WAService.js:19:16763)
at $t (http://127.0.0.1:12631/appservice/__dev__/WAService.js:19:30369)
at on (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:235)
at sn (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:573)
at Function.<anonymous> (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:3006)
at L.<anonymous> (http://127.0.0.1:12631/appservice/__dev__/WAService.js:19:1500)
这个困扰我了很长时间
解决方案
1、首先确认云开发已经开通了,开通以后要过十几分钟才能使用
2、然后确认项目的基础库版本,在开发工具右上角的"详情"按钮,可以选择调试基础库的版本,要2.2.3或以上才行
3、最后看看项目根目录下的app.js文件中,在onLaunch方法中是否有:
wx.cloud.init({
traceUser: true,
})