2016-10-18 4 views
2

나는 다음과 같은 코드를 가지고 :사용 : "UNMutableNotificationContent"

func sendLucidNotification() { 
    let content = UNMutableNotificationContent() 
    content.title = "10 Second Notification Demo" 
    content.subtitle = "From MakeAppPie.com" 
    content.body = "Notification after 10 seconds - Your pizza is Ready!!" 
    content.categoryIdentifier = "message" 

} 

나는 호출하면, UNMutableNotificationContent, 또는 나는 다음과 같은 오류 얻을 수있는 "UNMutableNotification"변화 :

Use of unresolved identifier: "UNMutableNotificationContent" 

I에게 Xcode 8.0에서,하지만 자동 완성을 시도 할 때도 인식하지 못합니다. 어떤 아이디어? 고맙습니다!

+1

당신이'UserNotifications' 프레임 워크를 가져올 수 있나요? –

답변

6

대부분의 아마 당신은 당신이 예컨대

import notification_framework_name 

은 또한 프레임 워크가 대상 빌드에 사용할 수 있는지 확인이 코드를 작성한 가져 오기 notification_framework 문을 추가해야합니다.

업데이트 : 귀하의 경우 import 문은 다음과 같습니다

import UserNotifications 
+0

Nirav D.의 의견은 실제로 구체적인 답변입니다. 위의 대답은 약간 수수께끼입니다. – Endran