Hi everyone, I am having an issue in the iOS Databases course, Module 3, Lesson 2. ( I am using Xcode 13.4 )
The problem is with the note under that video saying that at timestamp 8:45 I should import FirebaseEmailAuthUI instead of FirebaseUI, when I try to do this I get an error saying that there is no such module.
I also noticed that firebase works with libraries or SDK’s that I have to add in the package dependencies instead of adding pods in a pod file using cocoa pods.
I don’t know if this is the cause but because of this I can only add the FirebaseAuth SDK and not all the other pods shown in that lesson.
Does anyone know how I can add those other pods or how to fix my error?
One of the problems with Firebase is that the Developers of that software update and change things relatively often and that is sometimes very frustrating especially when the changes means that the tutorial is then broken.
The documentation for the Drop in Auth UI seems to be a bit sketchy.
I thought that at first too, but when I watch a little bit further in the video and add the code, I get an error saying it doesn’t recognize that code.
or is there a chance we can take a look at your code? if you have a repo for this can project of yours, can you add me as a contributor? or send a link here? My username is emptybasket on github.
I hope this helps you.
This is the file where I get an error:
//
// LoginForm.swift
// Firebase Auth Demo
//
// Created by Rune Pollet on 21/05/2022.
//
import Foundation
import SwiftUI
// I can't import FirebaseAuthUI here
import FirebaseAuth
struct LoginForm: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UINavigationController {
// This is a line of code that is added first in the lesson but it doesn't recognize it...
let authUI = FUIAuth.defaultAuthUI()
return UINavigationController()
}
func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {
}
}
Hi again,
is there any chance this code gives a clue on what I need to fix or how to fix it? Or do you have suggestions where I can search for a solution.
Bit stuck here unfortunately.
OK, I have just been messing around with the UIKit version of this “Drop-In Auth UI” and in that version the Firebase frameworks have been added using cocoapods. You wont get access to the right frameworks using Swift Package Manager for the reasons I mentioned in my last post.
So, if you want to have a crack at getting the SwiftUI version going (FirebaseAuthDemo) using cocoapods you will have to have the following pods specified in your Podfile:
pod 'Firebase/Auth'
pod 'FirebaseUI/Auth'
pod 'FirebaseUI/Email'
This is my ContentView (Note the import statement is different):
I have added those pods in my pod file and I used the .xcworkspace file instead of my original .xcodeproj file.
When I wrote import FirebaseEmailAuthUI and ran the project it all worked!
Thank you so much for thinking with me and helping me out, I actually don’t know why this worked so could you explain it to me so I could maybe learn from it?
I’m guessing that the reason it was not working in the first place was because you were opening the project using the xcodeproj file rather than the xcworkspace file.
During the pod installation process the xcworkspace file is created and from then on the project must be opened in Xcode using that file.
Same observation with @Chris_Parker, have you try opening the project using Firebase Auth Demo.xcworkspace? the one lighted on the image provided below?