뷰 컨트롤러 클래스에서 아래와 같이 추가해 주면 사용할 수 있다.
UIApplication.sharedApplication().applicationIconBadgeNumber = 숫자(INT)
푸시나 게시글 수를 받아서 표시해야 할 때 응용할 수 있겠다.
func viewDidLoad() 내에 아래를 추가해야
{Attempting to badge the application icon but haven't received permission from the user to badge the application}
위 메시지를 피하고 정상적으로 뱃지를 확인할 수 있다.
let settings = UIUserNotificationSettings(forTypes: .Alert, categories: nil)
UIApplication.sharedApplication().registerUserNotificationSettings(settings)
네비게이션 바 아이템 버튼에도 뱃지를 표시해야 하는데 빨리 찾을 수 있을지 모르겠다.
어렵지 않지만, 구현해보지 않았으므로 할 수 있다고 판단하기가 쉽지 않다.
댓글 달기