2016-10-18 62 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" 

我在Xcode 8.0上,但是當我嘗試自動完成時,它也不能識別它。有任何想法嗎 ?謝謝!

+1

你擁有自營'UserNotifications'框架? –

回答

6

最可能的是,你需要添加,你寫了這碼e.g

import notification_framework_name 

同時確保該框架可用於您的目標構建進口notification_framework聲明。

更新:你的情況import語句應該是:

import UserNotifications 
+0

尼拉夫D.評論實際上是具體的答案。上面的答案有點神祕。 – Endran

相關問題