{ "id": "172653", "key": "TIMOB-26594", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" }, { "id": "20429", "name": "Release 7.5.1", "archived": false, "released": true, "releaseDate": "2019-02-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-02-22T23:06:58.000+0000", "created": "2018-11-21T14:27:45.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "ios", "notifications" ], "versions": [], "issuelinks": [], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-04-04T16:23:47.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "I'm trying to cancel local iOS notifications with Ti.App.iOS.UserNotificationCenter.removePendingNotifications(notificationsToCancel), but whenever I try to call this with an array of notifications the app crashes.\r\n\r\nI did a little bit of research and it seems the ENSURE_TYPE on line 109 in TiAppiOSUserNotificationCenterProxy.m throws an exception. But I'm getting the notifications from getPendingNotifications so they should be ok right?\r\n\r\nExample (press schedule and then cancel right afterwards to get the exception):\r\n\r\n{code:java}\r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n title: 'Schedule'\r\n});\r\n\r\nvar isScheduling = true;\r\nbutton.addEventListener('click', function() {\r\n if (isScheduling) { \r\n var alarmObject = {\r\n date: new Date(new Date().getTime() + 20000),\r\n alertBody: \"Hello world\",\r\n badge: 1,\r\n identifier: \"test_id\",\r\n sound: 'default'\r\n };\r\n\r\n console.log('schedule: ' + JSON.stringify(alarmObject));\r\n \r\n Ti.App.iOS.scheduleLocalNotification(alarmObject);\r\n\r\n button.title = \"Cancel\";\r\n } else {\r\n Ti.App.iOS.UserNotificationCenter.getPendingNotifications(function(result) {\r\n if (result && result.notifications && result.notifications.length) {\r\n var notificationsToCancel = _.filter(result.notifications, function(n) {\r\n return n.identifier == \"test_id\";\r\n });\r\n\r\n console.log('cancel these: ' + JSON.stringify(notificationsToCancel));\r\n\r\n if (notificationsToCancel) {\r\n Ti.App.iOS.UserNotificationCenter.removePendingNotifications(notificationsToCancel);\r\n }\r\n }\r\n });\r\n\r\n button.title = \"Schedule\";\r\n }\r\n\r\n isScheduling = !isScheduling;\r\n});\r\n\r\nwindow.add(button);\r\n\r\nwindow.addEventListener('open', function() {\r\n Ti.App.iOS.registerUserNotificationSettings({\r\n types: [\r\n Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,\r\n Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,\r\n Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE\r\n ]\r\n });\r\n});\r\n\r\nwindow.open();\r\n{code}\r\n\r\nException:\r\n\r\n\r\n{code:java}\r\n[ERROR] The application has crashed with an uncaught exception 'org.testproject.TiAppiOSUserNotificationCenterProxy'.\r\n[ERROR] Reason:\r\n[ERROR] Invalid type passed to function\r\n[ERROR] Stack trace:\r\n[ERROR] 0 CoreFoundation 0x000000010f8881bb __exceptionPreprocess + 331\r\n[ERROR] 1 libobjc.A.dylib 0x000000010e683735 objc_exception_throw + 48\r\n[ERROR] 2 TestProject 0x0000000108c65b1d TiExceptionThrowWithNameAndReason + 141\r\n[ERROR] 3 TestProject 0x0000000108c21e7b -[TiProxy throwException:subreason:location:] + 107\r\n[ERROR] 4 TestProject 0x0000000108bb1f4f __66-[TiAppiOSUserNotificationCenterProxy removePendingNotifications:]_block_invoke_2 + 1055\r\n[ERROR] 5 UserNotifications 0x0000000110bc6161 __111-[UNUserNotificationServiceConnection getPendingNotificationRequestsForBundleIdentifier:withCompletionHandler:]_block_invoke_2.217 + 240\r\n[ERROR] 6 libdispatch.dylib 0x0000000110d9c4e1 _dispatch_call_block_and_release + 12\r\n[ERROR] 7 libdispatch.dylib 0x0000000110d9d54b _dispatch_client_callout + 8\r\n[ERROR] 8 libdispatch.dylib 0x0000000110da401c _dispatch_lane_serial_drain + 720\r\n[ERROR] 9 libdispatch.dylib 0x0000000110da4b95 _dispatch_lane_invoke + 455\r\n[ERROR] 10 libdispatch.dylib 0x0000000110dad9a8 _dispatch_workloop_worker_thread + 645\r\n[ERROR] 11 libsystem_pthread.dylib 0x0000000111182fd2 _pthread_wqthread + 980\r\n[ERROR] 12 libsystem_pthread.dylib 0x0000000111182be9 start_wqthread + 13\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: Exception when canceling local notifications with removePendingNotifications", "creator": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "macOS 10.13.6; iOS 12.1; SDK 7.5.0.GA", "closedSprints": [ { "id": 1106, "state": "closed", "name": "2019 Sprint 1", "startDate": "2018-12-31T19:39:58.070Z", "endDate": "2019-01-11T19:39:00.000Z", "completeDate": "2019-01-14T17:17:47.552Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "443881", "author": { "name": "astrovicapps", "key": "astrovicapps", "displayName": "Vittorio Sorbera", "active": true, "timeZone": "Europe/Berlin" }, "body": "I also had this problem. I can delete all notifications using\r\n {code:java}\r\nTi.App.iOS.UserNotificationCenter.removePendingNotifications()\r\n{code}\r\nbut if I want to delete a specific notification, the app crash.", "updateAuthor": { "name": "astrovicapps", "key": "astrovicapps", "displayName": "Vittorio Sorbera", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-11-26T15:28:16.000+0000", "updated": "2018-11-26T15:28:16.000+0000" }, { "id": "444081", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/10501", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-11-30T06:24:13.000+0000", "updated": "2018-11-30T06:24:13.000+0000" }, { "id": "444983", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed. Waiting for Jenkins build to become ready. ", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-04T11:30:22.000+0000", "updated": "2019-01-04T11:30:22.000+0000" }, { "id": "445099", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "Backport done in https://github.com/appcelerator/titanium_mobile/pull/10583", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-01-08T20:33:06.000+0000", "updated": "2019-01-08T20:33:06.000+0000" }, { "id": "445123", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed for 8_0_X .Waiting on Jenkins build. ", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-09T10:44:09.000+0000", "updated": "2019-01-09T10:44:09.000+0000" }, { "id": "445352", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as issue is resolved using SDK version {{ 8.0.0.v20190114160512 }}", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-01-15T18:19:03.000+0000", "updated": "2019-01-15T18:19:03.000+0000" }, { "id": "445788", "author": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "body": "Our team is currently working on a feature involving local notifications for a production app and facing this issue.\r\nv8.0.0 is beyond our planned feature release.\r\n\r\nCan this be back-ported into the 7.5.x stream please?", "updateAuthor": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "created": "2019-01-31T14:34:55.000+0000", "updated": "2019-01-31T14:34:55.000+0000" }, { "id": "446024", "author": { "name": "jonkravetz", "key": "jonkravetz", "displayName": "jon kravetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I agree with Nirmal, this isn't a new feature, this is a bug. Please implement changes for 7.5.x as we try not to use non-stable builds in production. This type of issue with resolutions not being back ported causes problems for our dev team.", "updateAuthor": { "name": "jonkravetz", "key": "jonkravetz", "displayName": "jon kravetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-02-12T19:09:37.000+0000", "updated": "2019-02-12T19:09:37.000+0000" }, { "id": "446025", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey guys, doing a backport to the 7.5.X branch should be no problem. However, i can not say for sure that there will be an official release with the fix. 7.5.1.GA is already locked and about to be released soon. I'll check with our release planning and let you know.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-02-12T20:04:25.000+0000", "updated": "2019-02-12T20:04:25.000+0000" }, { "id": "446088", "author": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "body": "hi Jan, any updates on likelihood of a back port?", "updateAuthor": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "created": "2019-02-15T04:29:06.000+0000", "updated": "2019-02-15T04:29:06.000+0000" }, { "id": "446144", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "The backport is currently waiting to be merged in https://github.com/appcelerator/titanium_mobile/pull/10707. You can build your own 7.5.X version directly from that PR if you need it asap.\r\n\r\nI'll let you know once it was merged and when i have news if and when it will make into an official release.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-02-18T20:35:53.000+0000", "updated": "2019-02-18T20:35:53.000+0000" }, { "id": "446497", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~Nirmalkumar_Patel], as you may have already noticed, this will be included in 7.5.1! Just to let you know.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-03-04T17:16:34.000+0000", "updated": "2019-03-04T17:16:34.000+0000" }, { "id": "446499", "author": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "body": "Awesome!!! Thanks.", "updateAuthor": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "created": "2019-03-04T17:51:04.000+0000", "updated": "2019-03-04T17:51:04.000+0000" }, { "id": "447468", "author": { "name": "chmiiller", "key": "chmiiller", "displayName": "Carlos Henrique Zinato", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hey @Jan Vennemann, are you sure this is working fine on 7.5.X?\r\nI've been trying to cancel my local notifications that were implemented with the deprecated Ti.App.iOS.cancelLocalNotification and tried to update it with the \"Ti.App.iOS.UserNotificationCenter.removePendingNotifications(id)\" but got an error saying that `Ti.App.iOS.UserNotificationCenter` is `undefined` and has no methods such `getPendingNotifications` or `removePendingNotifications`.\r\nTested with 7.5.1 and 7.5.2 from builds.appcelerator.com.\r\nOn Ti SDK 8.0 it seems to work just fine.\r\nI'm kind of concerned because now I cannot use the new `getPendingNotifications` or `removePendingNotifications` nor the deprecated `cancelLocalNotification` without updating to 8.0 =/\r\n\r\nThanks!", "updateAuthor": { "name": "chmiiller", "key": "chmiiller", "displayName": "Carlos Henrique Zinato", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-04-04T13:57:38.000+0000", "updated": "2019-04-04T13:57:38.000+0000" }, { "id": "447472", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~chmiiller], i just tried the following snippet with 7.5.1.GA and 7.5.2.v20190402102757 installed via CLI with {{ti sdk install -b 7_5_X}} and couldn't see any issues:\r\n\r\n{code:javascript}\r\nTi.App.iOS.UserNotificationCenter.getPendingNotifications((response) => {\r\n console.log(response);\r\n});\r\n{code}\r\n\r\nWhat exact builds did you try?", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-04-04T16:23:47.000+0000", "updated": "2019-04-04T16:23:47.000+0000" } ], "maxResults": 25, "total": 25, "startAt": 0 } } }