@@ -12,8 +12,10 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
1212 FirebaseApp . configure ( )
1313 UNUserNotificationCenter . current ( ) . delegate = self
1414 Messaging . messaging ( ) . delegate = self
15- print ( " [FCM][1] Firebase 초기화 완료, 알림 권한 요청 시작 " )
16- requestNotificationAuthorization ( )
15+ if let remotePayload = launchOptions ? [ . remoteNotification] as? [ AnyHashable : Any ] {
16+ FCMManager . shared. handleLaunchRemoteNotification ( remotePayload)
17+ }
18+ print ( " [FCM][1] Firebase 초기화 완료 " )
1719 return true
1820 }
1921
@@ -45,27 +47,6 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
4547 completionHandler ( . newData)
4648 }
4749
48- private func requestNotificationAuthorization( ) {
49- UNUserNotificationCenter . current ( ) . getNotificationSettings { settings in
50- print ( " [FCM][2] 현재 알림 권한 상태: \( settings. authorizationStatus. debugDescription) " )
51- }
52-
53- UNUserNotificationCenter . current ( ) . requestAuthorization ( options: [ . alert, . badge, . sound] ) { granted, error in
54- if let error {
55- print ( " [FCM][2] ❌ 알림 권한 요청 오류: \( error. localizedDescription) " )
56- return
57- }
58- print ( " [FCM][2] 알림 권한 \( granted ? " ✅ 허용 " : " ❌ 거부 " ) " )
59- if granted {
60- DispatchQueue . main. async {
61- print ( " [FCM][2] APNs 등록 요청 시작 " )
62- UIApplication . shared. registerForRemoteNotifications ( )
63- }
64- } else {
65- print ( " [FCM][2] ⚠️ 권한 거부 — 설정 앱에서 알림을 허용해야 합니다 " )
66- }
67- }
68- }
6950}
7051
7152extension AppDelegate : UNUserNotificationCenterDelegate {
@@ -108,16 +89,3 @@ extension AppDelegate: MessagingDelegate {
10889 FCMManager . shared. didReceiveToken ( token)
10990 }
11091}
111-
112- private extension UNAuthorizationStatus {
113- var debugDescription : String {
114- switch self {
115- case . notDetermined: return " notDetermined "
116- case . denied: return " denied ❌ "
117- case . authorized: return " authorized ✅ "
118- case . provisional: return " provisional "
119- case . ephemeral: return " ephemeral "
120- @unknown default : return " unknown "
121- }
122- }
123- }
0 commit comments