2017-04-03 1 views
2

내 앱의 경우 현지 알림 시스템을 구현하려고합니다. 알림은 소리가 나지만 아무 것도 표시하지 않습니다.

func scheduleNotification(_ Name:String, _ Time:DateComponents){ 
     let center = UNUserNotificationCenter.current() 
     let notification = UNMutableNotificationContent() 
     notification.title = Name 
     notification.sound = UNNotificationSound.default() 


     var trigger = UNCalendarNotificationTrigger(dateMatching: Time, repeats: false) 

     let identifier = Name 

     let request = UNNotificationRequest(identifier: identifier, content: notification, trigger: trigger) 
     center.add(request) 

    } 

은 이제 어제 일,하지만 더 이상하지 않습니다 다음과 같이 통지를 예약 할 수

내 코드입니다. 시뮬레이터와 장치 모두에서.

나는 아무 소용이 여기에 제안을 시도했습니다

: Local Notifications make sound but do not display (Swift) 내가 시도 무엇

: 응용 프로그램의 힘으로

  • 테스트를 배경
  • 의 응용 프로그램과 함께
  • 테스트를 폐쇄 식별자 변경하기

답변

2

body 통보. 더보기 Apple doc 너무 notification.title = Name 라인

notification.body = "Hello Notification" 

아래 줄을 추가합니다.

+0

고맙습니다.이게 내 문제를 해결했습니다 – Will

+0

가장 환영하는 사람 –

관련 문제