728x90
[iOS] application(_:didReceiveRemoteNotification..)과 userNotificationCenter(_:didReceive..) 이 같이 있을 때 주의사항
# notification을 눌렀을 때 들어오는 메소드 1) application(_:didReceiveRemoteNotification:fetchCompletionHandler:) - remote notification을 눌렀을 때 들어오는 메소드 2) userNotificationCenter(_:didRec..
eunjin3786.tistory.com
iOS Push Notification / Silent Push 에 대해 Araboza
굿데이 여러분 2021 잘 보내구 계신가여 올해 첫글을 2월에 쓰게 되다니 반성합니다 오늘은 Push Notification 에 대해서 알아보게씀니다 iOS 10 이상 기준으로 진행할건데여 카카오톡도 12.0 이상 부터
hryang.tistory.com
Push Notification callback함수들
- push notification을 사용할 때 AppDelegate에 선언하는 콜백 함수들은 크게 아래 3종류가 있다.
- func application(_: didReceiveRemoteNotification: fetchCompletionHandler:)
- func userNotificationCenter(_:willPresent:WithCompletionHandler)
- func userNotificationCenter(_:didReceive:WithCompletionHandler)
- userNotificationCenter라고 이름 붙은 메서드들은 UNUserNotificationCenter의 delegate 함수들이고 application은 AppDelegate의 함수이다.
func application(_: didReceiveRemoteNotification: fetchCompletionHandler:)
- iOS10이전부터 사용되던 함수이고 remote push에 대해서만 동작을 하게 된다.
- 아래의 함수들과 다르게 silent push가 오는 경우의 로직을 처리할 수 있다.
- background상태에서 일반 push가 오면 푸쉬 배너를 click했을 때 호출된다.
- silent push가 오는 경우에는 도착 즉시 메서드가 호출된다.
func userNotificationCenter(_:willPresent:WithCompletionHandler)
- iOS10부터 사용되고 local, remote push 둘 다 동작한다.
- foreground상태에서 push가 실행될 때 호출된다.
- 만약 application(:didReceive)와 동시에 선언되어있는 상태에서 silent push가 도착하면 둘 다 호출된다.
func userNotificationCenter(_:didReceive:WithCompletionHandler)
- iOS10부터 사용되고 local, remote push 둘 다 동작한다.
- background상태에서 push를 클릭했을 때 호출된다.
- 만약 application(:didReceive)와 동시에 선언되어있는 상태에서 remote push를 클릭 시 둘 다 호출된다.
728x90
'iOS > 설명' 카테고리의 다른 글
[iOS] URLSession (0) | 2022.05.16 |
---|---|
[iOS] UIViewPropertyAnimator (0) | 2022.05.15 |
[iOS] UIView.transition (0) | 2022.04.24 |
[iOS] performBatchUpdates (0) | 2022.04.24 |
[iOS] json파일 dictionary로 불러오기 (0) | 2022.04.22 |
댓글