当用户没有直接点击通知时,可以选择将有效负载排除在通知之外?

时间:2016-12-24 23:07:05

标签: ios push-notification uilocalnotification nsnotificationcenter cloudkit

我的应用程序中有一个通过观察者和发送者执行的方法,当用户点击本地/推送通知作为代理进程在" didReceiveRemoteNotification下的App Delegate中时,它可以正常工作。"但是,当用户忽略通知并改为点击应用程序时,该方法将无法执行。有没有办法解决这个问题?我使用通知的原因是因为我正在使用cloudkit,并且通知会在订阅时触发,该订阅会查看创建记录的时间。

离。发送方

[[NSNotificationCenter defaultCenter]
             postNotificationName:@"observeChange1"
             object:self];

前观察员

 [[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(observeChange1:)
                                             name:@"observeChange1"
                                           object:nil]; 

1 个答案:

答案 0 :(得分:0)

如果您使用iOS 10中的新通知,我认为您可以致电getDeliveredNotifications,但我不知道是否包含有效负载。