简体   繁体   中英

Connecting Firebase with NativeScript

So i installed firebase with adding the "google-services.json" in the App_Resources/Android folder.

在此处输入图片说明

After that i used the cli for the cmd: "tns plugin add @nativescript/firebase". And it was successfull.

在此处输入图片说明

But if i try to use "firebase.firestore()" i get the message that firestore is unknown.

在此处输入图片说明

Yes i have ticked yes in the installation as it asked me if i want firestore.

在此处输入图片说明

So it should be useful but it is not. I deleted the "firebase.nativescript.json" and run the 'npm run config' command in the android folder but it didnt help. Then I uninstalled the plugin with "tns plugin remove @nativescript/firebase" and re-installed it. Nothing works. Here is my fire in @nativescript:

在此处输入图片说明

Is there a Solution?

You should be able to import firestore directly from @nativescript/firebase and access its properties that way

import { firestore } from '@nativescript/firebase';

// firebase.firestore().collection('user') becomes the following line
firestore.collection('user')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM