如何在iOS中收听通知被驳回的事件?

Tru*_*an1 15 apple-push-notifications ios uilocalnotification ios8

我正在列出为我的本地通知按下的操作,但有没有办法确定用户何时解除通知?

这是我在AppDelegate中听我的动作的方式,但是解雇并没有解雇这个问题:

func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forLocalNotification notification: UILocalNotification, completionHandler: () -> Void) {
        var actionName: String? = nil

        if let identifier = identifier {
            switch identifier {
                case "snoozeAction":
                    actionName = "snoozeActionTapped"
                    break
                default: break
            }

            if let name = actionName {
                NSNotificationCenter.defaultCenter().postNotificationName(name, object: nil)
            }
        }

        completionHandler()
    }
Run Code Online (Sandbox Code Playgroud)

小智 9

解除通知不会唤醒您的应用程序,因此无法捕获它.