본문 바로가기

개발/React Native

[ReactNative] iOS 에서 FCM 을 받지 못할 때 추가해줘야 할 내용

새로 프로젝트를 만들어서 테스트 해보면 잘 오는데,

현재 프로젝트에 적용하면 FCM 이 안오는 문제가 있었다.

 

일주일 정도 삽질하다가 오늘에서야 해결이 되서 간단하게 기록한다.

 

https://stackoverflow.com/a/71163183

 

APNS device token not set before retrieving FCM Token for Sender ID - React Native Firebase

I have been following this tutorial to set-up Remote Push notifications on my react-native application using react-native-firebase Version 5.2.0. After I configured everything and ran the applicati...

stackoverflow.com

#import "FirebaseCore.h" // 이건 원래 있을 것이고
#import "FirebaseMessaging.h" // 이걸 상단에 추가

...

// 아래 코드 추가
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  [FIRMessaging messaging].APNSToken = deviceToken;
}

뭔가 firebase 버그인건지 문서가 엉망인건지는 모르겠지만 어쨌든 해결