Conversation
sangYuLv
added this pull request to stack #29
September 28, 2026 15:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA
📝 작업 내용
📌 요약
fcmToken→fcmInstallationID🔍 상세
[1] 저장·삭제 흐름
앱 실행(로그인 상태) / 로그인 직후: APNs 등록 →Messaging.register()호출 → 대리자didReceiveRegistration으로 설치 ID 수신 → Firestore 저장로그아웃,알림 권한 거부 상태로 포그라운드 진입: Firestore에서 삭제 (기존과 동일)[2] 이름 변경 (토큰 → 설치 ID)
FCMTokenRepository/FirestoreFCMTokenRepository→FCMInstallationIDRepository/FirestoreFCMInstallationIDRepositoryFCMTokenService/DefaultFCMTokenService→FCMInstallationIDService/DefaultFCMInstallationIDServiceAppDelegate: 메모리에 토큰을 들고 있던latestFCMToken제거, 대리자didReceiveRegistrationToken→didReceiveRegistration[3] 설정·패키지
Info.plist:FirebaseMessagingInstallationIdEnabled = YES(설치 ID 방식 활성화)💬 리뷰 노트
문제: 푸시 대상이 저장되지 않았습니다
9/20 이후 로그인 상태로 앱을 켜도, 재로그인해도 Firestore에 푸시 대상이 저장되지 않았습니다.
기존 코드는 FCM이 대리자(
didReceiveRegistrationToken)로 토큰을 알려줄 때 저장했습니다. 그런데 이 대리자는 토큰이 처음 생기거나 바뀔 때만 SDK가 알아서 호출하고, 앱이 "다시 알려줘"라고 요청할 방법이 없었습니다.그래서 "토큰이 처음 생긴 그 실행 + 로그인 상태"에서만 저장됐고, 그 뒤로 앱을 다시 켜면 대리자가 오지 않아 저장되지 않았습니다. (기기 로그로 확인: APNs 토큰 수신까지 정상, 대리자는 한 번도 호출되지 않음)
👉 결론: 원할 때 대리자를 다시 부를 수 있는 새 방식(
register())으로 전환개념: 토큰과 설치 ID
푸시를 보내려면 서버가 "어느 앱 설치로 보낼지" 주소를 알아야 합니다. 앱은 이 주소를 Firestore에 저장하고, 서버는 그걸 읽어 보냅니다.
token()(반환값으로 직접 받음)register()호출 → 대리자로 받음token— deprecated, 제거 예정fid— 권장단위는 같고, 중간에 토큰을 따로 발급하던 단계가 없어진 것입니다. 실제로 같은 기기의 토큰(
cRvbYBJxek3D…)과 설치 ID(cRvbYBJx…)는 앞부분이 같습니다.register()와 대리자의 관계register()의 완료 블록은 성공·실패만 알려주고, 설치 ID는 항상 대리자didReceiveRegistration으로 옵니다.register()를 불러도 기존 설치 ID로 다시 호출됩니다. (SDK 헤더FIRMessaging.h: "Calling this method when already registered will still invoke the delegate method … with the existing FID.")register()를 부릅니다. APNs 등록은 앱 실행과 로그인 직후 모두 일어나므로, 두 경우 모두 저장됩니다.기기 확인 (에뮬레이터 유저 문서): 로그아웃 시 삭제, 로그인 상태로 앱 재실행 시 설치 ID 저장 확인
토큰 방식을 고치지 않고 전환한 이유
토큰 방식에서도
token()으로 직접 받아 저장하면 버그는 해결됩니다(기기에서 확인). 그래도 전환한 이유는 이렇습니다.token()과 기존 대리자는 deprecated(SDK 12.18.0)라 새 경고가 생깁니다.token필드도 제거 예정입니다.참고할 변경점
추후 작업
fcmInstallationID를 Admin SDK 메시지의fid필드로 발송참고 문서
token필드 deprecated·제거 예정,fid권장FirebaseMessagingInstallationIdEnabled,didReceiveRegistrationregister()재호출 시 대리자 동작📸 영상 / 이미지