ZB-dev
ZB-dev

Reputation: 209

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!

Upvotes: 3

Views: 6734

Answers (1)

Tushar
Tushar

Reputation: 3052

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

Upvotes: 21

Related Questions