0

I would like to debug my following code under NotificationContentExtension. It's not working. Even print statement is not working. I tried to also add blur effect for my custom view. This is not working. I also put a break point on the specific line, it's also not working.

Please check the following code.

import UIKit
import UserNotifications
import UserNotificationsUI

class NotificationViewController: UIViewController, UNNotificationContentExtension {

    @IBOutlet var label: UILabel?

    override func viewDidLoad() {
        super.viewDidLoad()

        let blurEffect = UIBlurEffect(style: .extraLight)
        let blurEffectView = UIVisualEffectView(effect: blurEffect)
        blurEffectView.frame = self.view.frame
        print("blurEffect") // Can't see this on my console
        self.view.insertSubview(blurEffectView, at: 0) //not working blur effect

    }

    func didReceive(_ notification: UNNotification) {
        if let number = notification.request.content.userInfo["customNumber"] as? Int {
            label?.text = "\(number)"
              print("didReceive") // Can't see this on my console
        }
    }
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
IKKA
  • 6,297
  • 7
  • 50
  • 88

1 Answers1

0

Select your UNNotificationContentExtension as the active scheme. Then build and run.

lukaskasa
  • 498
  • 1
  • 8
  • 12