{ "id": "171150", "key": "TIMOB-25793", "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": [], "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2018-06-12T02:37:18.000+0000", "created": "2018-02-21T05:38:07.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "applebug", "escalation" ], "versions": [ { "id": "20060", "description": "", "name": "Release 7.0.2", "archived": false, "released": true, "releaseDate": "2018-02-09" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-08-06T17:34:45.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": "Hi, \r\n\r\nI am trying to enable push notifications on IOS device and when I grab token I am being asked to provide push notification permission. If I choose not to give it, error callback is not thrown. I copied code directly from Push Notifications Reference Guide: \r\n\r\nhttp://docs.appcelerator.com/platform/latest/#!/guide/Subscribing_to_push_notifications \r\n\r\nHere is the code: \r\n--------------------------------------------------------------------------------------------------------------------------------------------------- \r\n\r\n{code:java}\r\nvar deviceToken = null; \r\n\r\n// Check if the device is running iOS 8 or later \r\nif (Ti.Platform.name == \"iPhone OS\" && parseInt(Ti.Platform.version.split(\".\")[0]) >= 8) { \r\n\r\n// Wait for user settings to be registered before registering for push notifications \r\nTi.App.iOS.addEventListener('usernotificationsettings', function registerForPush() { \r\n\r\n// Remove event listener once registered for push notifications \r\nTi.App.iOS.removeEventListener('usernotificationsettings', registerForPush); \r\n\r\nTi.Network.registerForPushNotifications({ \r\nsuccess: deviceTokenSuccess, \r\nerror: deviceTokenError, \r\ncallback: receivePush \r\n}); \r\n}); \r\n\r\n// Register notification types to use \r\nTi.App.iOS.registerUserNotificationSettings({ \r\ntypes: [ \r\nTi.App.iOS.USER_NOTIFICATION_TYPE_ALERT, \r\nTi.App.iOS.USER_NOTIFICATION_TYPE_SOUND, \r\nTi.App.iOS.USER_NOTIFICATION_TYPE_BADGE \r\n] \r\n}); \r\n} \r\n\r\n// For iOS 7 and earlier \r\nelse { \r\n\r\nTi.Network.registerForPushNotifications({ \r\n// Specifies which notifications to receive \r\ntypes: [ \r\nTi.Network.NOTIFICATION_TYPE_BADGE, \r\nTi.Network.NOTIFICATION_TYPE_ALERT, \r\nTi.Network.NOTIFICATION_TYPE_SOUND \r\n], \r\nsuccess: deviceTokenSuccess, \r\nerror: deviceTokenError, \r\ncallback: receivePush \r\n}); \r\n} \r\n\r\n// Process incoming push notifications \r\nfunction receivePush(e) { \r\nalert('Received push: ' + JSON.stringify(e)); \r\n} \r\n// Save the device token for subsequent API calls \r\nfunction deviceTokenSuccess(e) { \r\ndeviceToken = e.deviceToken; \r\n} \r\n\r\nfunction deviceTokenError(e) { \r\nalert('Failed to register for push notifications! ' + e.error); //this is the function that never gets thrown. \r\n} \r\n{code}\r\n\r\n--------------------------------------------------------------------------------------------------------------------------------------------------- \r\n\r\nNote that deviceTokenError never gets thrown once permission has been granted/revoked.\r\n\r\n*Expected Result:* error callback should be fired when not granting push notification permission.\r\n*Actual Result:* error callback never be fired.\r\n\r\nThanks ", "attachment": [ { "id": "64876", "filename": "push-check.mov", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-21T19:12:03.000+0000", "size": 1077373, "mimeType": "video/quicktime" }, { "id": "64877", "filename": "test_push.zip", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-21T20:22:38.000+0000", "size": 32491, "mimeType": "application/zip" }, { "id": "65062", "filename": "test_push-workaround.zip", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-18T15:37:09.000+0000", "size": 45099, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: No callback when not granting push notification permission (Apple bug)", "creator": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.13.2\r\n\r\nNode.js\r\n Node.js Version = 8.9.4\r\n npm Version = 5.6.0\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\nTitanium SDK\r\n SDK Version = 7.0.2.GA\r\n \r\n Target Platform = iphone 5s v11.2.5", "closedSprints": [ { "id": 1035, "state": "closed", "name": "2018 Sprint 11 SDK", "startDate": "2018-05-20T20:57:43.542Z", "endDate": "2018-06-03T20:57:00.000Z", "completeDate": "2018-06-04T15:13:14.425Z", "originBoardId": 114 }, { "id": 1039, "state": "closed", "name": "2018 Sprint 12 SDK", "startDate": "2018-06-03T15:22:23.401Z", "endDate": "2018-06-17T15:22:00.000Z", "completeDate": "2018-06-18T20:45:36.363Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "434701", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with SDK 6.3 on iPhone 6 v11.2.1, iPhone 7 v 10.2 iPad v9", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-21T14:41:01.000+0000", "updated": "2018-02-21T14:41:01.000+0000" }, { "id": "434709", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey there! I've validated the test-case and it works fine. See the attachment (push-check.mov) for details. I'll try to isolate if it may have issues in the (deprecated) kroll-thread or JSCore usage.\r\n\r\n*EDIT*: Those use-cases work as well. Did you ensure that your event listeners are still in your scope and not null?. Here is my test-case:\r\n{code:js}\r\nvar deviceToken = null; \r\n \r\n// Check if the device is running iOS 8 or later \r\nfunction checkPush() { \r\n // Wait for user settings to be registered before registering for push notifications \r\n Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() { \r\n // Remove event listener once registered for push notifications \r\n Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush); \r\n \r\n Ti.Network.registerForPushNotifications({ \r\n success: deviceTokenSuccess, \r\n error: deviceTokenError, \r\n callback: receivePush \r\n }); \r\n }); \r\n \r\n // Register notification types to use \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\n// Process incoming push notifications \r\nfunction receivePush(e) { \r\n alert('Received push: ' + JSON.stringify(e)); \r\n} \r\n// Save the device token for subsequent API calls \r\nfunction deviceTokenSuccess(e) { \r\n deviceToken = e.deviceToken; \r\n alert('SUCCESS!');\r\n} \r\n \r\nfunction deviceTokenError(e) { \r\n alert('Failed to register for push notifications! ' + e.error); //this is the function that never gets thrown. \r\n} \r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Trigger'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n checkPush();\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-21T19:11:36.000+0000", "updated": "2018-02-21T19:14:20.000+0000" }, { "id": "434713", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Hans,\r\n\r\nI wonder if it is because you use a simulator to test? All of my devices are exhibiting the same behavior. I am pretty sure event listeners are in scope since I am able to get token and receive and read push data when permission is granted. It is only error response that is not triggering event callback. \r\n\r\n Also, did you run it on 6.3 SDK? \r\n\r\nN. ", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-21T19:18:44.000+0000", "updated": "2018-02-21T19:20:12.000+0000" }, { "id": "434714", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "I did not test it on the device so far, but will tomorrow morning. Testing on older SDK's will be part of it. I'll let you asap, likely tomorrow morning.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-21T19:20:30.000+0000", "updated": "2018-02-21T19:20:30.000+0000" }, { "id": "434715", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I looked up my old emails and you did recommend a workaround for this issue which was to use Ti.Network.remoteNotificationEnabled() and it works, but I'd rather get to the bottom of the problem this time around.\r\n\r\nThanks for looking at it for me.\r\n", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-21T19:24:21.000+0000", "updated": "2018-02-21T19:24:21.000+0000" }, { "id": "434719", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Yeah I remember (although I wasn't able to find the mail thread). Did I send you [this link|https://stackoverflow.com/a/38456437/5537752] and [this one|https://stackoverflow.com/a/34332047/5537752]? Especially the following sounds like a thing:\r\n{quote}\r\niOS Note: If a cellular or Wi-Fi connection is not available, neither the application:didRegisterForRemoteNotificationsWithDeviceToken: method nor the application:didFailToRegisterForRemoteNotificationsWithError: method is called. For Wi-Fi connections, this sometimes occurs when the device cannot connect with APNs over port 5223. If this happens, the user can move to another Wi-Fi network that isn’t blocking this port or, on an iPhone or iPad, wait until the cellular data service becomes available. In either case, the device should be able to make the connection, and then one of the delegation methods is called.\r\n{quote}\r\nWe really do not do anything special in handling the permissions and just invoke the callbacks that Apple calls. We'll handle this, no worries!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-21T19:33:59.000+0000", "updated": "2018-02-21T20:27:01.000+0000" }, { "id": "434723", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "No, it was [this link|https://stackoverflow.com/questions/1535403/determine-on-iphone-if-user-has-enabled-push-notifications/28323624#28323624]\r\n\r\nI will ask our Wifi masters for the port and see if that is what causes it.", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-21T19:58:45.000+0000", "updated": "2018-02-21T19:58:45.000+0000" }, { "id": "434725", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Wifi masters :-D Can you send one to Germany as well? My Wifi here really underperforms today. By the way, I couldn't wait and tested on the device as well. It works fine. Awaiting feedback from your masters! You may also want to test it by disabling Wifi btw.\r\n\r\n*EDIT*: I added a proper certificate and it now reproduces! I'll validate on a native project and an older Ti version next.\r\n\r\n*EDIT 2*: Reproducible on 6.3.0 as well. And the native delegate do not even fire. Checking more details ...\r\n\r\n*EDIT 3*: Bad news: It's happening for native projects (Swift / ObjC) as well (and I finally found a Stackoverflow [link|https://stackoverflow.com/a/9582638/5537752] as well). I'll file a bug at Apple tomorrow and so should you to prioritize it. See the native test-case attached to this ticket for details.\r\n\r\nLet me know if we can do more for you at this point or resolve it until Apple fixes it. Thank you!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-21T20:00:19.000+0000", "updated": "2018-02-21T20:27:18.000+0000" }, { "id": "434769", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Glad you were able to recreate it. \r\n\r\nThis being iOS bug, I'd say lets see what they have to say about it. \r\n\r\nI will try to file this with Apple as well in the next couple days. ", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-22T14:57:16.000+0000", "updated": "2018-02-22T14:57:16.000+0000" }, { "id": "436973", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey Nikita! I got pinged by support if we can provide a possible workaround and I thought about a possible one. You can see the (working) solution in the \"test_push-workaround.zip\" attachment, which shows the workaround using a native project first. The same can be done in Titanium by listening to the \"blur\" and \"focus\" events. Let me know your thoughts about it and if we should deliver the Titanium code or you do it. Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-04-18T15:39:46.000+0000", "updated": "2018-04-18T15:39:46.000+0000" }, { "id": "436977", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks Hans, I will try to get it tested in the next few days.", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-04-18T17:31:36.000+0000", "updated": "2018-04-18T17:31:36.000+0000" }, { "id": "437124", "author": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Hans, \r\n\r\nI realized I did not read your comment close enough to notice it contains native code. Unfortunately, I only know a small amount of objective C, but I doubt that even that is enough to understand what is going on. Would it be possible for you to compile a sample Titanium project that I can quickly run? I've already got a sample project setup for Push so I just need a controller code.\r\n\r\nThanks,\r\n\r\nN.", "updateAuthor": { "name": "nradaev", "key": "nradaev", "displayName": "Nikita Radaev", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-04-24T18:19:30.000+0000", "updated": "2018-04-24T18:26:48.000+0000" }, { "id": "437894", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey Nikita! We will prepare a project later this week or early next week. Thanks for following up!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-05-23T19:41:28.000+0000", "updated": "2018-05-23T19:41:28.000+0000" }, { "id": "438323", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~nradaev] Soooory, that took too long on my end! WWDC and related kept us busy. I prepared a Ti-based example of the native workaround, here you go: https://gist.github.com/hansemannn/62b67b384915d7e64c0a711b4afb1b73\r\n\r\nWe have also filed a ticket at Apple a while back and are awaiting feedback about it, but it looks like it low-prio for them as of for now.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-12T02:36:59.000+0000", "updated": "2018-06-12T02:36:59.000+0000" }, { "id": "439828", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closed as completed. If this is in error, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:34:45.000+0000", "updated": "2018-08-06T17:34:45.000+0000" } ], "maxResults": 20, "total": 20, "startAt": 0 } } }