Home>
I want to ask

I am making an application using Firebase.
So

reason: '`[FIRApp configure];` (`FirebaseApp.configure ()` in Swift) could not find a valid GoogleService-Info.plist in your project.Please download one from https: // console .firebase.google.com /.'


It stops with the error.

Code Sign-up screen (the first screen)
// accountViewcontroller
import UIKit
import Firebase
import FirebaseAuth
class AccountViewController: UIViewController, UITextFieldDelegate {
    var account: FirebaseApp!
    @IBOutlet private weak var nameTextField: UITextField!
    @IBOutlet private weak var emailTextField: UITextField!
    @IBOutlet private weak var passwordTextField: UITextField!
    @IBAction private func didTapSignUpButton () {
        let email = emailTextField.text ?? ""
        let password = passwordTextField.text ?? ""
        let name = nameTextField.text ?? ""
        Auth.auth (). CreateUser (withEmail: email, password: password) {[weak self] result, error in
            guard let self = self else {return}
            if let user = result? .user {
                let req = user.createProfileChangeRequest ()
                req.displayName = name
                req.commitChanges () {[weak self] error in
                    guard let self = self else {return}
                    if error == nil {
                        user.sendEmailVerification () {[weak self] error in
                            guard let self = self else {return}
                            if error == nil {
                                // Process to transition to temporary registration completion screen
                                // keep sign-up complete flag
                                UserDefaults.standard.set (true, forKey: "appSignUpStatusKey")
                                UserDefaults.standard.synchronize ()
                            }
                            self.showErrorIfNeeded (error)
                        }
                    }
                    self.showErrorIfNeeded (error)
                }
            }
            self.showErrorIfNeeded (error)
        }
                // keep sign-up complete flag
                UserDefaults.standard.set (true, forKey: "appSignUpStatusKey")
                // save username
                UserDefaults.standard.set (name, forKey: "userNameKey")
                UserDefaults.standard.synchronize ()
        if (email == "" || password == "" || name == "") {
            let message = "Please fill in all forms"
            let alert = UIAlertController (title: nil, message: message, preferredStyle: .alert)
            alert.addAction (UIAlertAction (title: "OK", style: .default, handler: nil))
            self.present (alert, animated: true, completion: nil)
        }
            }private func showErrorIfNeeded (_ errorOrNil: Error?) {
        // do nothing if there is no error
        guard let error = errorOrNil else {return}
        let message = "An error has occurred" // This will be described later, but for the time being a fixed string
        let alert = UIAlertController (title: nil, message: message, preferredStyle: .alert)
        alert.addAction (UIAlertAction (title: "OK", style: .default, handler: nil))
        present (alert, animated: true, completion: nil)
    }


    // AccountViewController assumption
    override func viewDidLoad () {
        super.viewDidLoad ()
        self.navigationController? .navigationBar.isHidden = true
        self.nameTextField.delegate = self
        self.emailTextField.delegate = self
        self.passwordTextField.delegate = self

    }
    override func touchesBegan (_ touches: Set<UITouch>, with event: UIEvent?) {
        self.view.endEditing (true)
    }
}
AppDelegate
// AppDelegate
import UIKit
import CoreData
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application (_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)->Bool {
        // Override point for customization after application launch.
        FirebaseApp.configure ()
        return true
    }
    // MARK: UISceneSession Lifecycle
    func application (_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions)->UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration (name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }
    func application (_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application: didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }
    // MARK:-Core Data stack
    lazy var persistentContainer: NSPersistentContainer = {
        / *
         The persistent container for the application.
         creates and returns a container, having loaded the store for the
         application to it.This property is optional since there are legitimate
         error conditions that could cause the creation of the store to fail.
        * /
        let container = NSPersistentContainer (name: "new_timer3")container.loadPersistentStores (completionHandler: {(storeDescription, error) in
            if let error = error as NSError? {
                // Replace this implementation with code to handle the error appropriately.
                // fatalError () causes the application to generate a crash log and terminate.You should not use this function in a shipping application, although it may be useful during development.
                / *
                 Typical reasons for an error here include:
                 * The parent directory does not exist, cannot be created, or disallows writing.
                 * The persistent store is not accessible, due to permissions or data protection when the device is locked.
                 * The device is out of space.
                 * The store could not be migrated to the current model version.
                 Check the error message to determine what the actual problem was.
                 * /
                fatalError ("Unresolved error \ (error), \ (error.userInfo)")
            }
        })
        return container
    } ()
    // MARK:-Core Data Saving support
    func saveContext () {
        let context = persistentContainer.viewContext
        if context.hasChanges {
            do {
                try context.save ()
            } catch {
                // Replace this implementation with code to handle the error appropriately.
                // fatalError () causes the application to generate a crash log and terminate.You should not use this function in a shipping application, although it may be useful during development.
                let nserror = error as NSError
                fatalError ("Unresolved error \ (nserror), \ (nserror.userInfo)")
            }
        }
    }
}
For Podfiles
// Podfile
# Uncomment the next line to define a global platform for your project
platform: ios, '9.0'
target 'new_timer3' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  # Pods for new_timer3
pod 'Firebase/Database'
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
  target 'new_timer3Tests' do
    inherit!: search_paths
    # Pods for testing
  end
  target 'new_timer3UITests' do
    # Pods for testing
  end
end
What I did

For the time being, I felt that GoogleInfoPlist was not downloaded, so I tried downloading it again, but the result is the first error.

  • Answer # 1

    Thank you for your cooperation. It was solved by hayabusabusash's method! !