파이어베이스 앱 등록(ios)

 

1. Firebase에 앱 등록

notion image
 

2. GoogleService-Info.plist 파일 추가

notion image
 

3. Firebase SDK 추가 (Podfile 수정)

notion image
pod 'Firebase/Analytics' # add the Firebase pod for Google Analytics # or pod ‘Firebase/AnalyticsWithoutAdIdSupport’ # for Analytics without IDFA collection capability # add pods for any other desired Firebase products # https://firebase.google.com/docs/ios/setup#available-pods
 

4. 초기화 코드 추가 (네이티브 코드 수정)

SwiftObjective-C냐 보고 선택해서 추가하면 됨.
일반적으로 react-native에서 변환된 코드는 Objective-C 코드다.
notion image
import UIKit import Firebase // <----- 추가 @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure() // <------ 추가 return true } }
notion image
// @import 구문은 반드시 @implementation 바로 위에 선언해야함. @import UIKit; // <----- 추가 @import Firebase; // <----- 추가 @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIRApp configure]; // <------ 추가 return YES; }
 

5. 설정 끝

notion image