How to listen for notification dismissed event in iOS?

﹥>﹥吖頭↗ 提交于 2019-12-04 23:12:19

Dismissing a notification does not wake your application up so there is no way to capture this.

You should try this:

 func application(application: UIApplication!,
            handleActionWithIdentifier identifier:String!,
            forLocalNotification notification:UILocalNotification!,
            completionHandler: (() -> Void)!){

                if (identifier == "FIRST_ACTION"){

                    NSNotificationCenter.defaultCenter().postNotificationName("actionOnePressed", object: nil)

                }else if (identifier == "SECOND_ACTION"){
                    NSNotificationCenter.defaultCenter().postNotificationName("actionTwoPressed", object: nil)

                }

                completionHandler()

        }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!