iOS Swift/Library, Framework 연동

[iOS/Swift] ios 파이어베이스 연동 Firebase Auth (1)

주니어코더 2023. 6. 20. 17:28

 

 

 

 

 

 

 iOS 와 파이어베이스 연동하기

 

Swift로 Firebase Auth 회원정보 구현 1탄

"파이어베이스 연동"

 

 

 

 

 

 

 

Chap1.  파이어베이스 프로젝트 생성


 

파이어베이스 콘솔 사이트에서 프로젝트를 생성

 

 

 

아래 파이어베이스 콘솔 사이트에서 로그인 후 새 프로젝트를 만든다

 

https://firebase.google.com/?hl=ko

 

Firebase

Firebase is an app development platform that helps you build and grow apps and games users love. Backed by Google and trusted by millions of businesses around the world.

firebase.google.com

 

 

 

 

 

Chap2.  Apple 앱에 Firebase 추가, 앱등록


 

파이어베이스를 적용할 ios프로젝트를 등록한다

 

 

 

🚫 주의 🚫

Apple 번들 ID를 입력해야 하는데,
Project Targets → 해당 Project General Identity Bundle Indentifier 확인

 

 

 

👇 아래 그림 참조 👇 

 

 

 

 

 

 

 

Chap3.  구성 파일 다운로드 후 추가


 

앱등록을 하면 구성파일이 생성된다

 

GoogleService-Info.plist 파일을 Xcode 프로젝트의 루트에 추가한다

 

 

 

 

 

 

 

 

Chap4.  Firebase SDK 추가


 

프로젝트의 Podfile에 FirebaseSDK를 추가한다

 

 

🥥 CocoaPods 이용해 Firebase라이브러리 설치

 

🚫 주의 🚫

podfile 설치 시 xcode 프로젝트를 닫은 후 실행

 

 

 

1. Podfile이 없는 경우, Podfile 생성

 

프로젝트 경로에서 터미널 오픈 후 명령어 실행

 

pod init

 

 

 

2. Podfile에 Firebase pod 추가

 

위에서 생성한 Podfile에 아래 pod을 추가한다

 

pod 'FirebaseAuth'
pod 'FirebaseFirestore'

 

 

 

3. Podfile 설치

 

pod install

 

 

 

4. xworkspace 파일을 열어 확인

 

 

 

 

 

Chap5.  초기화 코드 추가


 

앱이 시작될 때 Firebase에 연결하려면 아래의 초기화 코드를 AppDelegate에 추가

 

 

import UIKit
import FirebaseCore


@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  func application(_ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions:
      [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    FirebaseApp.configure()

    return true
  }
}

 

 

 

 

 

여기까지 따라왔다면 ios와 Firebase 연동 끝🔥

 

 

 

 

 

 

 

 

참조: https://firebase.google.com/docs/ios/setup?hl=ko 

 

Apple 프로젝트에 Firebase 추가  |  Apple 플랫폼용 Firebase

Google I/O 2023에서 Firebase의 주요 소식을 확인하세요. 자세히 알아보기 의견 보내기 Apple 프로젝트에 Firebase 추가 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요

firebase.google.com

 

반응형