[TIMOB-26444] Calling Titanium.App.iOS.UserNotificationCenter.getDeliveredNotifications causes 'NSInvalidArgumentException'
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2018-10-08T17:35:15.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.4.1 |
Components | iOS |
Labels | n/a |
Reporter | Richard Lustemberg |
Assignee | Vijay Singh |
Created | 2018-09-25T12:36:28.000+0000 |
Updated | 2018-10-19T18:38:22.000+0000 |
Description
Calling Titanium.App.iOS.UserNotificationCenter.getDeliveredNotifications causes 'NSInvalidArgumentException'.
The first line of the stacktrace
-[UNNotification content]: unrecognized selector sent to instance
points to a type mismatch. The code attempts to get the 'content' property on UNNotification instead of UNNotificationRequest.
Code should be modified to look like this. I can provide a PR
[[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> *notifications) {
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[notifications count]];
for (UNNotification *notification in notifications) {
[result addObject:[self dictionaryWithUserNotificationRequest:[notification request]]];
}
[~rlustemberg] Have you get chance to verify your issue with SDK 7.4.1 as several notification issues have been fixed in ticket TIMOB-26399? I saw that you were watching that ticket actively. Thanks!
Hello [~rlustemberg], Can you get back to us after trying on SDK 7.4.1. Thanks.
I think it was not fixed on the PR, but I’ll have a look as soon as I’m at my computer
Just had a look and the code was not fixed in the PR from TIMOB 26399
[~rlustemberg] Would you like to provide a PR for same? It would be great. We can review it and merge. Thanks!
I'll take care of that as soon as I'm back home (in about 8 hours from now). The branch for the PR is not in my laptop.
Merged [~rlustemberg]'s PR to master and 7_4_X.