小编Ric*_*ues的帖子

没有这样的模块“FirebaseFirestore”

尝试构建我的应用程序,但它总是给我带来 FirebaseFirestore 的问题。

\n\n

它似乎可以很好地识别 FirebaseStorage 和 Firebase,但不能识别 FireStore。

\n\n

以下是有问题的图像和一些代码:

\n\n

错误

\n\n

代码:

\n\n
import UIKit\nimport FirebaseFirestore //No such module \'FirebaseFirestore\'    \nvar docRefIm: DocumentReference!\nvar docRefImC: CollectionReference!\n\nclass carregar: UIViewController,UINavigationControllerDelegate, UIImagePickerControllerDelegate {\n    @IBOutlet weak var upload: UIButton!\n    @IBOutlet weak var myImage: UIImageView!\n    @IBAction func uploadBt(_ sender: Any) {\n\n        let image = UIImagePickerController()\n        image.delegate = self\n        image.allowsEditing = true\n        image.sourceType = UIImagePickerControllerSourceType.photoLibrary\n        self.present(image, animated: true){\n\n        }\n    }\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试删除并重新安装 Pod、删除模块、添加方案,但似乎没有任何效果。

\n\n

这是 pod 文件:

\n\n
# Uncomment the next line to define …
Run Code Online (Sandbox Code Playgroud)

ios firebase swift google-cloud-firestore

6
推荐指数
1
解决办法
8931
查看次数

将所有字段名称从 firestore 文档获取到数组列表

我正在尝试ArrayList从文档中获取包含所有字段名称的文件并将其转换为ArrayList.

我已经能够从一个集合中做到这一点,我将所有文档都放在一个集合中,ArrayList但我不能从一个文档中做到这一点。

下面是所有文档的代码和数据库的图像以及我想要的。

names_clinics= new ArrayList<>();

    mFirebaseFirestore = FirebaseFirestore.getInstance();
    mFirebaseFirestore.collection("CodeClinic")
            .get()
            .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
                @Override
                public void onComplete(@NonNull Task<QuerySnapshot> task) {
                    if (task.isSuccessful()) {
                        for (DocumentSnapshot document : task.getResult()) {
                            names_clinics.add(document.getId());
                            Log.d("CLINIC CODE", document.getId() + " => " + document.getData());
                        }
                    } else {
                        Log.d("CLINIC CODE", "Error getting documents: ", task.getException());
                    }
                }
            });
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

谢谢:D

java android arraylist firebase google-cloud-firestore

3
推荐指数
1
解决办法
3016
查看次数

当我返回到 Fragment 时,立即调用观察者

我有一个观察者,而不是当它被称为更改片段时。

问题是当我返回时,立即调用观察者,并且我的应用程序崩溃了

java.lang.IllegalArgumentException:导航目标 com.superapps.ricardo.tablepro:id/action_searchFragment_to_yourGameList2 对于此 NavController 来说是未知的。

我不明白为什么会这样称呼它。

这是更改列表的唯一方法

override fun onSuccess(gamePair: Pair<Int, List<BggGame>>) {
        CoroutineScope(Main).launch{
            //goToList(gamePair.second, binding.input.text.toString())
            viewModel.setGameList(gamePair.second)
        }
    }
Run Code Online (Sandbox Code Playgroud)

这是视图模型创建和更改片段代码

override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        viewModel = ViewModelProviders.of(this).get(SearchViewModel::class.java)
        viewModel.gameList.observe(viewLifecycleOwner, Observer {
            goToList(it, binding.input.text.toString())
        })
    }


    private fun goToList(games: List<BggGame>, user: String) {
        val action = SearchFragmentDirections.actionSearchFragmentToYourGameList2(user)
        val gameList = GameList()
        gameList.gameList = games
        action.gameList = gameList

        try {
            Navigation.findNavController(view!!).navigate(action)
            viewModel.gameList.removeObservers(viewLifecycleOwner)
        } catch (e: Exception){
            Log.e("a0,","a..", e)
        }
        progressDialog.dismiss()

    }
Run Code Online (Sandbox Code Playgroud)

android observers kotlin

3
推荐指数
1
解决办法
1644
查看次数