Import Firebase in AppDelegate

FirebaseApp.configure()

it will crash

could not find a valid GoogleService-Info.plist in your project.

내 프로젝트에서는 다음과 같은 오류가 나지 않았지만 위와 같은 오류가 발생한다고 한다.

Firebase에서 iOS앱에 Firebase 추가로 GoogleService-Info.plist 를 추가해준다. make sure you check Copy items if needed

What the ?

  pod 'GoogleAppMeasurement', '~> 5.2.0'

이걸로 해결 I think it’s the version problem so I have to use 5.2.0

change sign-in method as email in Firebase authentification


JGProgressHUD

GitHub

An elegant and simple progress HUD for iOS and tvOS.

What’s the meaning of HUD??

It’s Heads Up Display

import Firebase
import FirebaseAuth // for some reasons
@objc fileprivate func handleRegister() {
        print("Register our User in Firebase Auth")
        guard let email = emailTextField.text else { return }
        guard let password = passwordTextField.text else { return }
        
        Auth.auth().createUser(withEmail: email, password: password) { (res, err) in
            
            if let err = err {
                print(err)
                self.showHUDWithError(error: err)
                return
            }
            
            print("Successfully registered user:", res?.user.uid ?? "")
        }
    }

guard와 if 를 사용한 optional binding의 느낌을 체감하자. 어느 때 사용해야 더 적합한지를

import JGProgressHUD
    fileprivate func showHUDWithError(error: Error) {
        let hud = JGProgressHUD(style: .dark)
        hud.textLabel.text = "Failed registration"
        hud.detailTextLabel.text = error.localizedDescription
        hud.show(in: self.view)
        hud.dismiss(afterDelay: 4)
    }

이렇게하면 끝!

태그:

카테고리:

업데이트:

댓글남기기