[iOS/Swift] 'alert' was deprecated in iOS 14.0

bibi·2022년 10월 28일
0

iOS

목록 보기
2/3
post-thumbnail

UNNotificationPresentationOptions 중 .alert가 iOS 14부터 deprecated 되었다.

https://developer.apple.com/forums/thread/661953


.list

.list로 옵션을 주었을때는 App이 켜진 상태에서는 상단에 배너로 알림이 오지 않는다.
상단 부분을 아래로 스크롤하여 Notification Center(잠금 화면)를 확인했을때 Notification이 쌓여있는 것을 확인할 수 있다.

App이 꺼진 상태(홈 화면 또는 다른 앱 사용중)에서는 상단에 배너로 알림이 오고,

Notification Center(잠금 화면)에도 이렇게 쌓인다.


.banner로 옵션을 주었을때는 App이 켜진 상태에서도 상단에 배너로 알림이 온다.

그리고 이 알람은 Notification Center(잠금 화면)에 쌓이지 않고 사라진다.

App이 꺼진 상태에서도 상단에 배너로 알림이 뜬다.

App이 꺼진 상태에서 상단에 배너로 뜬 알람은 Notification Center에 쌓인다.


결론

App이 켜져 있든 꺼져 있든, 상단 배너에도 뜨고, Notification Center(잠금 화면)에도 뜨도록 하고 싶다면, UNNotificationPresentationOptions에 .banner와 .list를 둘 다 써주면 된다.

profile
Spread positive vibe and love 🫶

0개의 댓글