{ "id": "172135", "key": "TIMOB-26339", "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": "20220", "name": "Release 7.3.1", "archived": false, "released": true, "releaseDate": "2018-08-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-08-29T06:43:37.000+0000", "created": "2018-08-27T13:37:36.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "ios", "notifications" ], "versions": [ { "id": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-11-07T09:26:22.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've noticed that local push notifications won't be shown when setting the repeat property, it does show when it's omitted. This seems to have started with SDK 7.3.0.GA.\r\n\r\nExample:\r\n\r\n\r\n{code:java}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"white\",\r\n layout: \"vertical\"\r\n});\r\n\r\nvar repeatSwitch = Ti.UI.createSwitch();\r\n\r\nvar btn = Ti.UI.createButton({\r\n top: 50,\r\n title: \"Schedule\"\r\n});\r\n\r\nbtn.addEventListener(\"click\", function() {\r\n var not = {\r\n date: new Date(new Date().getTime() + 3000),\r\n alertTitle: 'Notification',\r\n alertBody: 'This is a notification',\r\n badge: 1,\r\n userInfo: {\r\n id: '1'\r\n },\r\n repeat: repeatSwitch.value ? \"daily\" : undefined\r\n };\r\n\r\n console.log('schedule: ' + JSON.stringify(not));\r\n\r\n Ti.App.iOS.scheduleLocalNotification(not);\r\n});\r\n\r\nwin.add(btn);\r\nwin.add(Ti.UI.createLabel({\r\n text: \"Repeat?\"\r\n}));\r\nwin.add(repeatSwitch);\r\n\r\nwin.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\nwin.open();\r\n{code}\r\n", "attachment": [ { "id": "65487", "filename": "TiAppiOSProxy.m", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-28T12:02:08.000+0000", "size": 50508, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "iOS: Local notification not triggered when setting repeat (only 7.3.0.GA)", "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": "iOS 11.4, SDK version 7.3.0.GA", "comment": { "comments": [ { "id": "441086", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey there! We refactored the whole notifications-API to use the new UserNotifications framework in iOS 10+. Your issue sounds valid and we'll provide a fix for this early this week. Thank you!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-27T14:31:42.000+0000", "updated": "2018-08-27T14:31:42.000+0000" }, { "id": "441131", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10289\r\nPR (7_4_X): https://github.com/appcelerator/titanium_mobile/pull/10291\r\nPR (7_3_X): https://github.com/appcelerator/titanium_mobile/pull/10290\r\n\r\nTest-Case: Above\r\n\r\n[~teunklijn@telfort.nl] Can you please do me a favor and replace the attached [^TiAppiOSProxy.m] in the following directory:\r\n{code}\r\n~/Library/Application Support/Titanium/mobilesdk/osx/7.3.0.GA/iphone/Classes/TiAppiOSProxy.m\r\n{code}\r\nYou can make a backup of the old file to be sure. Let me know if it works properly now! Spontaneously, I didn't find a way to test if the notification will be triggered 24 hours later, but the new code looked good :-).", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-28T07:01:00.000+0000", "updated": "2018-08-28T12:02:41.000+0000" }, { "id": "441132", "author": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "The attached TiAppiOSProxy.m seems to be identical to the one that I already have, so the notification doesn't trigger yet. I've tried the one from the pull request, but that also doesn't trigger. I could have used the wrong one.", "updateAuthor": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2018-08-28T07:31:45.000+0000", "updated": "2018-08-28T09:02:00.000+0000" }, { "id": "441142", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~teunklijn@telfort.nl] Sorry, try again. It was the old one from an earlier Git revision.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-28T12:02:29.000+0000", "updated": "2018-08-28T12:02:29.000+0000" }, { "id": "441144", "author": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "It does work better now, the notification does trigger if you schedule only 1, but if you schedule 2 notifications in a row only the 2nd notification will appear. It doesn't matter if you set repeat or not, for example:\r\n\r\n{code:java}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"white\",\r\n layout: \"vertical\"\r\n});\r\n\r\nvar repeatSwitch = Ti.UI.createSwitch();\r\n\r\nvar btn = Ti.UI.createButton({\r\n top: 50,\r\n title: \"Schedule\"\r\n});\r\n\r\nbtn.addEventListener(\"click\", function() {\r\n var not = {\r\n date: new Date(new Date().getTime() + 3000),\r\n alertTitle: 'Notification',\r\n alertBody: 'This is a notification 1',\r\n badge: 1,\r\n userInfo: {\r\n id: '1'\r\n },\r\n repeat: repeatSwitch.value ? \"daily\" : undefined\r\n };\r\n\r\n console.log('schedule: ' + JSON.stringify(not));\r\n\r\n Ti.App.iOS.scheduleLocalNotification(not);\r\n\r\n not = {\r\n date: new Date(new Date().getTime() + 6000),\r\n alertTitle: 'Notification',\r\n alertBody: 'This is a notification 2',\r\n badge: 1,\r\n userInfo: {\r\n id: '1'\r\n },\r\n repeat: repeatSwitch.value ? \"daily\" : undefined\r\n };\r\n\r\n console.log('schedule: ' + JSON.stringify(not));\r\n\r\n Ti.App.iOS.scheduleLocalNotification(not);\r\n});\r\n\r\nwin.add(btn);\r\nwin.add(Ti.UI.createLabel({\r\n text: \"Repeat?\"\r\n}));\r\nwin.add(repeatSwitch);\r\n\r\nwin.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\nwin.open();\r\n{code}\r\n", "updateAuthor": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2018-08-28T13:13:27.000+0000", "updated": "2018-08-28T13:18:02.000+0000" }, { "id": "441146", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "That probably happens because the default {{identifier}} is used if not explicitly set. I noticed that this only happens for the new UserNotifications framework on iOS 10+, so it may be an Apple bug or per design. A simple fix is to assign different {{identifier}} strings to make them unique. This also helps to better manage pending / delivered notifications.\r\n\r\n*EDIT*: Confirmed to work with the following:\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"white\",\r\n layout: \"vertical\"\r\n});\r\n \r\nvar repeatSwitch = Ti.UI.createSwitch();\r\n \r\nvar btn = Ti.UI.createButton({\r\n top: 50,\r\n title: \"Schedule\"\r\n});\r\n \r\nbtn.addEventListener(\"click\", function() {\r\n var not = {\r\n date: new Date(new Date().getTime() + 3000),\r\n alertTitle: 'Notification',\r\n alertBody: 'This is a notification 1',\r\n badge: 1,\r\n identifier: '1',\r\n userInfo: {\r\n id: '1'\r\n },\r\n repeat: repeatSwitch.value ? \"daily\" : undefined\r\n };\r\n \r\n console.log('schedule: ' + JSON.stringify(not));\r\n \r\n Ti.App.iOS.scheduleLocalNotification(not);\r\n \r\n not = {\r\n date: new Date(new Date().getTime() + 6000),\r\n alertTitle: 'Notification',\r\n alertBody: 'This is a notification 2',\r\n identifier: '2',\r\n badge: 1,\r\n userInfo: {\r\n id: '1'\r\n },\r\n repeat: repeatSwitch.value ? \"daily\" : undefined\r\n };\r\n \r\n console.log('schedule: ' + JSON.stringify(not));\r\n \r\n Ti.App.iOS.scheduleLocalNotification(not);\r\n});\r\n \r\nwin.add(btn);\r\nwin.add(Ti.UI.createLabel({\r\n text: \"Repeat?\"\r\n}));\r\nwin.add(repeatSwitch);\r\n \r\nwin.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\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-28T14:12:41.000+0000", "updated": "2018-08-28T14:23:56.000+0000" }, { "id": "441147", "author": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "That does indeed work! Thank you for your help.", "updateAuthor": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2018-08-28T14:23:29.000+0000", "updated": "2018-08-28T14:23:29.000+0000" }, { "id": "441148", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "I just pushed another commit to make notifications on iOS 10+ unique by default, to match the iOS < 10 behavior for now. It internally generates a UUID-string that is also injected into the \"userInfo.id\" if not already set, so it can be used to identifier them later again. Does that match your expectations of the API?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-28T14:42:50.000+0000", "updated": "2018-08-28T14:42:50.000+0000" }, { "id": "441149", "author": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Yes that does match my expectations.", "updateAuthor": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2018-08-28T14:44:41.000+0000", "updated": "2018-08-28T14:44:41.000+0000" }, { "id": "441173", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fix in SDK version {{7.5.0.v20180828231421}} and {{7.3.1.v20180828234519}}.\r\n\r\n*Test Steps FR*\r\n# Created a new titanium project \r\n# Added the code from the description in to the application \r\n# Ran the program \r\n# Enabled scheduled push notifications\r\n# Pressed schedule \r\n# Went to the home screen \r\n# Able to see the push notifications trigger\r\n# Created a new application with the second test case in the comments \r\n# followed the steps above (3-7)\r\n# Able to see both notifications trigger \r\n\r\n*Test Environment*\r\n{code:java}\r\nAPPC Studio: 5.1.0.201808080937\r\nAPPC CLI: 7.0.6-Master.5\r\niphone 6 simulator (11.2)\r\niphone 6 simulator (9.3)\r\nOperating System Name: Mac OS High Sierra\r\nOperating System Version: 10.13.6\r\nNode.js Version: 8.9.1\r\nXcode 10.0 beta 6\r\n{code}\r\n\r\n*Note:* Waiting for the 7_4_X build from Jenkins.\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-29T08:26:36.000+0000", "updated": "2018-08-29T08:26:36.000+0000" }, { "id": "441176", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing Ticket* Verified fix in SDK Version {{7.4.0.v20180829012158}} With the above steps.", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-29T09:09:26.000+0000", "updated": "2018-08-29T09:09:26.000+0000" }, { "id": "443356", "author": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi, it seems like this has now broken the scheduling of local notification when you DO NOT set \"repeat\"\r\n\r\nThe code below will never fire the notification\r\n{code:java}\r\n\t// The following code snippet schedules an alert to be sent within three seconds\r\n\tvar notification = Ti.App.iOS.scheduleLocalNotification({\r\n\t\tcategory: \"TEST\",\r\n\t\talertAction: 'Read now',\r\n\t\talertBody: 'Custom message',\r\n\t\tdate: new Date(new Date().getTime() + 30000),\r\n\t\t//repeat: \"never\",\r\n\t\t//The following URL is passed to the application\r\n\t\tuserInfo: {\r\n\t\t\t\"task\": \"test2\"\r\n\t\t}\r\n\t});\r\n{code}\r\n", "updateAuthor": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-07T09:22:27.000+0000", "updated": "2018-11-07T09:22:27.000+0000" }, { "id": "443357", "author": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "dieskim", "key": "dieskim", "displayName": "David van de Meer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-07T09:26:22.000+0000", "updated": "2018-11-07T09:26:22.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }