{ "id": "93041", "key": "TIMOB-9481", "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": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13408", "description": "Sprint 2012-12 API", "name": "Sprint 2012-12 API", "archived": true, "released": true, "releaseDate": "2012-06-17" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-05-02T21:41:43.000+0000", "created": "2012-06-11T11:12:10.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "ios8", "module_notification_manager", "qe-3.4.0", "qe-testadded", "regression" ], "versions": [ { "id": "13273", "description": "Release 2.0.2", "name": "Release 2.0.2", "archived": false, "released": true, "releaseDate": "2012-05-31" }, { "id": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" } ], "issuelinks": [ { "id": "17929", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "92930", "key": "TIMOB-9516", "fields": { "summary": "iOS: scheduleLocalNotification crash app - Ti SDK - > 2.0", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-05-02T21:41:43.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": "In 'bg.js' of kitchensink, notifications cannot be cancelled using 'id' passed as userinfo dictionary to the notification.\r\n\r\n{panel:title=bg.js}\r\n{code}\r\n\r\nvar notification = Ti.App.iOS.scheduleLocalNotification({\r\n\talertBody:\"Kitchen Sink was put in background\",\r\n\talertAction:\"Re-Launch!\",\r\n\tuserInfo:{id:\"1\"},\r\n\tsound:\"pop.caf\",\r\n\tdate:new Date(new Date().getTime() + 3000) // 3 seconds after backgrounding\r\n});\r\n\r\n// we cancel our notification if we don't want it to continue\r\n// notification.cancel(); //this works!!!!\r\n\r\n\r\nTi.App.iOS.cancelLocalNotification(\"1\");// this does not work.\r\n\r\n{code}\r\n\r\nThis is fixed by Pedro and the fix is available here.\r\n\r\nhttps://gist.github.com/48a765c50f64aa7c47ed", "attachment": [], "flagged": false, "summary": "iOS: cancelLocalNotification on iOS is broken", "creator": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Ti SDK 2.0.2 and iOS 5.1", "closedSprints": [ { "id": 199, "state": "closed", "name": "2014 Sprint 18 SDK", "startDate": "2014-09-02T22:56:57.421Z", "endDate": "2014-09-13T00:00:00.000Z", "completeDate": "2014-09-15T20:08:19.146Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "198301", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2383", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-06-13T01:36:40.000+0000", "updated": "2012-06-13T01:36:40.000+0000" }, { "id": "198418", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pull merged. Kudos to Pedro.", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-13T19:37:49.000+0000", "updated": "2012-06-13T19:37:49.000+0000" }, { "id": "199200", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing issue\r\n\r\nTested with Ti Studio build 2.1.0.201206172244\r\nTi Mobile SDK 2.1.0.v20120618154152 hash r7830c03d\r\nOSX Lion 10.7.3\r\niPhone 4S OS 5.1\r\n\r\nThe expected behavior is shown", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-19T14:54:08.000+0000", "updated": "2012-06-19T14:54:08.000+0000" }, { "id": "321268", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The cancelLocalNotification is not working on iOS8 device. It works fine for the same build on iOS 7.1 device.\r\n\r\nTested On:\r\nSDK: 3.4.0.v20140829184521, 3.3.0.GA\r\nStudio: 3.4.0.201408291834\r\nCLI: 3.4.0-dev\r\nXcode: Xcode 6 Beta6, XCode5.1.1\r\nDevice: iPhone 5S (v8.0), iPhone 4 (v7.1)\r\n\r\nWhile testing on iOS 8, the notification sometimes might not come the first time or might take time. On second try it shows the notification despite of cancelLocalNotification", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-02T04:14:00.000+0000", "updated": "2014-09-02T04:14:00.000+0000" }, { "id": "322150", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "h6. Why aren't we fixing this?\r\nThis is an iOS 8 issue that is easily worked around. When we schedule a notification, it does not immediately show up in the list of scheduled notifications. Because of this, when we call `cancelLocalNotification` immediately after scheduling a notification, the new notification does not show up in the list of scheduled notifications and therefor can not be cancelled.\r\n\r\nh6. Alternatives\r\n1. Do not call `cancelLocalNotification` immediately after scheduling the notification, but set a small timeout first. See the example code below.\r\n2. Call the `cancel` method no the notification object returned by `scheduleLocalNotification`.\r\n\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff'\r\n});\r\n\r\nvar setButton = Titanium.UI.createButton({\r\n\ttitle:'set',\r\n\twidth:500,\r\n\theight:40,\r\n\ttop:40\r\n});\r\nsetButton.addEventListener('click', function()\r\n{\r\n\r\n Ti.App.iOS.registerForLocalNotifications({\r\n types: Ti.App.iOS.NOTIFICATION_TYPE_SOUND | \r\n\t\t\t\tTi.App.iOS.NOTIFICATION_TYPE_ALERT | \r\n\t\t\t\tTi.App.iOS.NOTIFICATION_TYPE_SOUND\r\n });\r\n\r\n\tvar notification = Ti.App.iOS.scheduleLocalNotification({\r\n alertBody:\"Kitchen Sink was put in background\",\r\n alertAction:\"Re-Launch!\",\r\n userInfo:{id:\"1\"},\r\n date:new Date(new Date().getTime() + 3000) // 3 seconds after backgrounding\r\n });\r\n\r\n // we cancel our notification if we don't want it to continue\r\n // notification.cancel(); //this works!!!!\r\n\r\n setTimeout(function() {\r\n \tTi.App.iOS.cancelLocalNotification(\"1\");\r\n }, 500);\r\n});\r\n\r\nwin1.add(setButton);\r\n\r\nwin1.open();\r\n{code}", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-05T21:58:54.000+0000", "updated": "2014-09-05T21:58:54.000+0000" }, { "id": "418868", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Resolving ticket as Invalid as there is now a new version of Kitchen Sink available and we no longer support the version which relates to this ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-05-02T21:41:43.000+0000", "updated": "2017-05-02T21:41:43.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }