问题描述
升级到 NS7 并更新我的代码导入后,我无法使用 firebase 'firestore' 功能。每当调用任何 firebase 存储功能时,我都会收到:
CONSOLE ERROR: ERROR TypeError: Cannot read property 'listAll' of undefined
同一个应用程序能够成功使用firestore来检索集合和文档,但似乎无法识别存储功能。
app.component.ts
import { firestore,storage } from "@nativescript/firebase";
storage.listAll({
bucket: "gs://appname-xxxx.appspot.com",remoteFullPath: ""
}).then(
function (result) {
console.log(JSON.stringify(result));
},function (error) {
console.log(error);
}
);
firebase.nativescript.json
{
"using_ios": true,"using_android": false,"analytics": true,"firestore": true,"realtimedb": false,"authentication": true,"remote_config": false,"performance_monitoring": false,"external_push_client_only": false,"messaging": false,"in_app_messaging": false,"crashlytics": true,"storage": true,"functions": false,"facebook_auth": true,"google_auth": true,"admob": false,"dynamic_links": false,"ml_kit": false
}
解决方法
试试下面的导入格式
onkeydown = "return ((event.keyCode != 186) && (event.keyCode != 32) && (event.keyCode != 188));"
这将避免“未定义”