首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在NotificationContentExtension下调试代码?

如何在NotificationContentExtension下调试代码?
EN

Stack Overflow用户
提问于 2017-12-01 21:31:59
回答 0查看 97关注 0票数 0

我想在NotificationContentExtension下调试下面的代码。这不管用。甚至打印语句也不起作用。我还试着为我的自定义视图添加模糊效果。这不管用。我还在特定的行上设置了一个断点,它也不起作用。

请检查以下代码。

代码语言:javascript
复制
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
        }
    }
}
EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47594540

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档