Application has no precise way to determine whether a remote notification was actioned by the user
| Originator: | argentumko | ||
| Number: | rdar://21812523 | Date Originated: | 14-Jul-2015 |
| Status: | Duplicate of 18537988 (Open) | Resolved: | Yes |
| Product: | iOS SDK | Product Version: | iOS 3 – iOS 8 |
| Classification: | Enhancement | Reproducible: | Always |
Summary: When an application receives a remote (push) notification via application delegate's "didReceiveRemoteNotification" method, it is sometimes required to determine whether that notification was actioned by the user (swiped on Lock Screen, tapped in Notification Center, tapped a notification banner, etc.), or not (happens if notification was received by the device while application was in foreground). iOS SDK does not provide a precise way to determine this, so applications have to resort to heuristics: like using current application state to infer whether notification was actioned on. This can be tricky, since while in "inactive" state, new notifications are pushed directly to the application, but it's also possible to tap on old notifications in the Notification Center. There are creative solutions to this problem, but it would be great if iOS SDK provided an exact answer. Steps to Reproduce: 1. In an iOS application, configure receiving push notifications, register for them. 2. Trigger a push notification remotely. 3. If application is in foreground, notification is delivered to the application immediately. 4. If application is in background, notification appears in Notification Center and/or Lock Screen. This notification would be delivered to the application if/when user actions on it. However, user can also open the application via its icon, and then open Notification Center and tap on the notification while application is in foreground. Expected Results: Ideally, iOS SDK should provide a flag of some kind passed to the application delegate's "didReceiveRemoteNotification" method to determine whether notification was actioned by the user or received without user's interaction. Actual Results: Application delegate gets called "-application:didReceiveRemoteNotification:" or " -application:didReceiveRemoteNotification:fetchCompletionHandler:" (whichever's implemented) regardless of how notification was received, without a way to determine whether it was actioned on. Version: As of iOS 9 Seed 2, this issue is not addressed yet. Configuration: Any hardware
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Vlas Voloshin
With the introduction of UserNotifications.framework in iOS 10, this is no longer the case: applications are now explicitly informed when a default action has been triggered on a notification, and when a notification is received specifically in active foreground state. Thanks! This issue can now be marked as resolved.