React Native 푸쉬 사용

react-native@react-native-firebase/appreact-native-push-notification@react-native-community/push-notification-ios@react-native-firebase/messagingbuild.gradleAppDelegate.mmGoogleService-Info.plistgoogle-servicesAndroid StudioxcodeFirebaseCorefirebase-ios-sdk
avatar
2025.04.10
·
1 min read

@react-native-firebase/app

설치

yarn add react-native-push-notification @react-native-community/push-notification-ios @react-native-firebase/app @react-native-firebase/messaging

Android

// android/build.gradle

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.3.15'
    }
}
// android/app/build.gradle

apply plugin: 'com.google.gms.google-services'
dependencies {
    implementation platform('com.google.firebase:firebase-bom:31.2.2')
}

IOS

// XCode > Add Packages > Seach: https://github.com/firebase/firebase-ios-sdk > Add Package > Check: FirebaseMessaging > Add Package

// ios/<project>/AppDelegate.mm
#import <Firebase.h>
#import <FirebaseCore.h>
#import <FirebaseMessaging.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    if ([FIRApp defaultApp] == nil) {
    [FIRApp configure];
  }
    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
}
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true

주의할 점

GoogleService-Info.plist 파일과 google-services 파일은 각각 Android Studio, XCode에서 드래그로 넣어줘야 내부에서 파일끼리 자동으로 참조 할 수 있다.

IOS Error

Redefinition of module 'FirebaseCore'

  1. XCode에서 프로젝트 클릭

  2. Package Dependencies 탭 클릭

  3. firebase-ios-sdk 삭제







- 컬렉션 아티클