iOS

[iOS] APN, FCM 정리

728x90

APN

: Apple Push Notification Service

  • 보안관리

1️⃣  connection trust

  1. provider to apns connection trust : 서버측
    • token -base: 유효한 인증키인지 판단
    • certificate-base: ssl 인증서
  2. Apns to device connection trust: 클라측

: 승인된 장치만 알림을 받을 수 있도록 하는 것

 

2️⃣  Device token trust

: 오직 apns만 장치 토큰을 읽을 수 있다.

디바이스나 앱의 상태가 변경되었을때 새로 발급 → 항상 고유한 상태 유지

  • 새로운 폰
  • 백업으로 복원
  • iOS 버전 업그레이드

Firebase Cloud Messaing

: 손쉽게 원격 알림을 구축할 수 있는 서비스 → 서버의 역할을 FCM이 대신한다!

  • 원격 알림 메시지 전송
  • 다양한 메시지 타겟팅
  • 발송 메시지 저장, 관리

→ 웹 콘솔을 활용한다!

 

앱 생명주기 컨트롤

1. 앱은 꺼져있는데 푸시를 받고, 해당 푸시를 클릭했을 때

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {}

2. 앱이 현재 화면에서 실행되고 있을 때

@available(iOS 10.0, *)

    public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Swift.Void){}

3. 앱은 꺼져있지만 완전히 종료되지 않고 백그라운드에서 실행중일 때

@available(iOS 10.0, *)

    public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Swift.Void){}

⚠️  2,3 번은 UNUserNotificationCenterDelegate 사용해야함

 

[참고]

[SWIFT] APNS, 푸시에 관한 설정(receive event, click(tap) event)

728x90

'iOS' 카테고리의 다른 글

[iOS] iOS 캡쳐 방지 기술  (3) 2022.11.01
[iOS] 클로저에서 [weak self] 알아보기  (0) 2022.07.27
[iOS] UIStackView 정리  (0) 2022.07.12
[iOS] Xcode error 대처 방법  (0) 2022.06.06
[iOS] AppDelegate와 SceneDelegate, App의 생명주기  (0) 2022.01.21