Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26444] Calling Titanium.App.iOS.UserNotificationCenter.getDeliveredNotifications causes 'NSInvalidArgumentException'

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionFixed
Resolution Date2018-10-08T17:35:15.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.4.1
ComponentsiOS
Labelsn/a
ReporterRichard Lustemberg
AssigneeVijay Singh
Created2018-09-25T12:36:28.000+0000
Updated2018-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]]];
        }

Comments

  1. Vijay Singh 2018-10-04

    [~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!
  2. Sharif AbuDarda 2018-10-05

    Hello [~rlustemberg], Can you get back to us after trying on SDK 7.4.1. Thanks.
  3. Richard Lustemberg 2018-10-06

    I think it was not fixed on the PR, but I’ll have a look as soon as I’m at my computer
  4. Richard Lustemberg 2018-10-06

    Just had a look and the code was not fixed in the PR from TIMOB 26399
  5. Vijay Singh 2018-10-07

    [~rlustemberg] Would you like to provide a PR for same? It would be great. We can review it and merge. Thanks!
  6. Richard Lustemberg 2018-10-07

    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.
  7. Christopher Williams 2018-10-08

    Merged [~rlustemberg]'s PR to master and 7_4_X.

JSON Source