Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of unresolved identifier: "UNMutableNotificationContent"

I have the following code:

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"

}

When I call, UNMutableNotificationContent, or any "UNMutableNotification" variation I get the following error:

Use of unresolved identifier: "UNMutableNotificationContent"

I'm on Xcode 8.0, but when I try autocompleting it doesn't recognize it either. Any ideas ? Thank you!

like image 438
ZB-dev Avatar asked Nov 29 '22 22:11

ZB-dev


1 Answers

Most probably you need to add the import notification_framework statement where you have written this code e.g

import notification_framework_name

Also make sure the framework is available for your target build.

Update: in your case the import statement would be :

import UserNotifications
like image 154
Tushar Avatar answered Mar 15 '23 02:03

Tushar