iOS/트러블 슈팅

트러블슈팅) iOS. APNS 등록 후 "didRegisterForRemoteNotificationsWithDeviceToken" 함수 실행 안됨.

Brad_Heo 2023. 11. 24. 15:45

문제

APNS 등록 후 didRegisterForRemoteNotificationsWithDeviceToken 호출이 안되는 문제 발생 그로 인해 deviceToken 값을 가져오지 못함

해결

info.plistFirebaseAppDelegateProxyEnabled 추가 후 type: "Boolean", value: "NO" 추가

해결과정

FirebaseApp.configure() 실행 시 FIRMessaging으로 인해 APNS가 자동으로 설정되어 함수 호출이 안된 것 같다. 그래서 FirebaseAppDelegateProxyEnabled는 Application delegate이 받은 APNS를 설정하는데 사용된다. 값을 "NO"로 하게 되면 APNS가 수동으로 설정되어 didRegisterForRemoteNotificationsWithDeviceToken 실행되는 것으로 보인다.

참고자료

https://stackoverflow.com/questions/37933387/firebase-cloud-messaging-doesnt-create-push-notifications-but-gets-information