728x90
반응형
import UserNotifications
override func viewDidLoad() {
super.viewDidLoad()
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert,.sound]) { (granted, error) in
}
let content = UNMutableNotificationContent()
content.title = "될까요?"
content.body = "되겠지"
let date = Date().addingTimeInterval(3)
let dateComponents = Calendar.current.dateComponents([.year,.month,.day,.hour,.minute,.second], from: date)
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: false)
let uuidString = UUID().uuidString
let request = UNNotificationRequest(identifier: uuidString, content: content, trigger: trigger)
center.add(request) { (error) in
}
}
728x90
반응형
'🍎 iOS > UI' 카테고리의 다른 글
[iOS/UI] 테이블뷰 제일 위로 가기 (0) | 2020.02.14 |
---|---|
[iOS/UI] System Icon 사용법 (0) | 2020.02.05 |
[iOS] link url로 이동하기 (0) | 2020.01.15 |
[iOS/UI] 폰트 적용하기(feat.네비게이션타이틀) (0) | 2020.01.13 |
[iOS] 네비게이션 컨트롤러가 연결된 뷰컨트롤러에 세그값 넘기기(UINavigationController Segue and UIRootViewController) (0) | 2020.01.12 |
댓글