Implement Notification Service and Content Extension in Dynamic Framework


I have implemented Extension Notification Service and Notification Content Extension in my demo app and it’s working absolutely fine.

Now, I have to implement it in my framework. Means I’m working on dynamic framework which are support as like chat application. In framework all screens are created programatically, Its doesn’t contains any storyboard or XIB.

I have setup all required configuration for Notification Service Extension and Notification Content Extension same as like my demo app in framework. Everything is same as per my double check on it.

I’m struggling to implement Notification Service Extension and Notification Content Extension.

Should I need to create Notification Content programmatically instead of Storyboard ?
Should I need to add target dependencies ?
What I’m missing ?

On Dragging notification it’s doesn’t show me notification content.

Below is the code which I’m currently using for local notification for testing. This code is working in demo app.

@available(iOS 10.0, *)
func scheduleNotification() {

    UNUserNotificationCenter.current().delegate = self

    let content = UNMutableNotificationContent()
    content.title = "Notification"
    content.body = "We will remind you that your notification demo is performed well."
    content.sound = UNNotificationSound.default()
    content.categoryIdentifier = "myNotificationCategory"
    content.userInfo = ["Image" as AnyHashable: ""]

    let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
    let request = UNNotificationRequest(identifier: "request", content: content, trigger: trigger)
    UNUserNotificationCenter.current().add(request) { (error) in
        if error != nil {
            print("Error to add notification: (error!.localizedDescription)")
        } else {
            print("Notification added")

I’m also testing it by debugging, but didReceive(_ notification: UNNotification) is also not calling.

I’m stuck ! Please help me? Help will be appreciated.

Source: Swift

Categorised as ios10, notifications, swift


Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us