Error with firestore

Guys I am trying to build my project, and I face this error: cannot find firestore in scope.

I think that maybe it’s a pod problem, but I checked the pods. (I don’t know if I did the right check)

Maybe I can show you more if you know how to solve it.

Thank you very much in advance​:slight_smile::slight_smile::pray:

Make sure that your pod definition looks like this:

  # Pods for CustomLoginDemo
	pod 'Firebase/Analytics'
	pod 'Firebase/Auth'
	pod 'Firebase/Core'
	pod 'Firebase/Firestore'
	pod 'FirebaseFirestoreSwift'

Close the project in Xcode then…
In terminal use the command:
pod update
which ensures that the local pod definitions are updated and then adds the appropriate pods to the project.

When you open your project, make sure that you open it via YourProjectName.xcworkspace rather than YouProjectName.xcodeproj

2 Likes

I am facing the same error actually and I tried updating the pod and everything but it still gives me the same error. Any suggestions would be appreciated.

Thank you.

Hey Abdalla, even if your error message is the same as Dod_Mav’s error message, the cause of your’s might be different. Have you tried Chris Parker’s suggestions above? If you have, then also double check that at the top of your file, you have a “import Firestore”.

It would helpful to see some screenshots too!

Thanks
Chris

Have you added the cocoapods for this project? Refer to chris parker for the list of pods to add…
If you are not familiar with cocoapods check this article https://codewithchris.com/cocoapods/

Thank you for the quick response. “I had import Firebase” at the top but then I added “import FirebaseFirestore” and that worked. Didn’t know there was a difference.

Hi Chris,
Thanks for your solution, worked like a charm! For other people with the same issue open your Podfile add Chris text, save the file, and follow Chris explanation.

Yup, same problem here. I used package manager to add the dependancies and had the import statement at the top and still no luck! I have put it all over the file and it always says “Firestore not in scope” Screen Shot 2022-06-12 at 1.26.53 AM|690x431

I had to also add the pods from Chris Parker’s response and then include just import Firebase. Import FirebaseCore was not necessary.