[TIMOB-26349] iOS 10: A couple of issues related to remote push-notifications
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Duplicate |
| Resolution Date | 2018-09-19T18:27:08.000+0000 |
| Affected Version/s | Release 6.0.0, Release 7.0.0, Release 7.3.0, Release 7.3.1 |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | n/a |
| Reporter | Hans Knöchel |
| Assignee | Hans Knöchel |
| Created | 2018-09-01T10:52:01.000+0000 |
| Updated | 2018-09-19T18:27:32.000+0000 |
Description
There are a couple of issues with notifications on iOS right now:
On iOS 10+, the contents of the "aps" key are not in the top-level of the "data" key that is returned by the callback of the
On all supported iOS versions, if a remote notification action is triggered and the app is closed, the
On all supported iOS versions, silent pushes are fired to both the
(PR was reverted to do some more tests) Test-Case: 1. Create a new app suitable for remote push notifications (with it's certs, provisioning profiles, aps-environment etc) 2. Copy the below code in the app.js / index.js 3. Download the app "Pusher" to simulate push messages from your mac 4. Import your .p12 certificate, paste your device-token received from the "success" callback of your push-registration and try around with it (leave out "content-available" to test non-silent-pushes):
JS-code:{ "aps":{"alert":"Testing.. (30)","badge":1,"sound":"default", "content-available": 1 }}var deviceToken = null; // Wait for user settings to be registered before registering for push notifications Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() { // Remove event listener once registered for push notifications Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush); Ti.Network.registerForPushNotifications({ success: deviceTokenSuccess, error: deviceTokenError, callback: receivePush }); }); Ti.App.iOS.addEventListener('silentpush', function(e) { Ti.API.info('SILENTPUSH received'); Ti.API.info(e); }); // Process incoming push notifications function receivePush(e) { Ti.API.info('Remote push received'); Ti.API.info(e); } // Save the device token for subsequent API calls function deviceTokenSuccess(e) { deviceToken = e.deviceToken; Ti.API.info('Device-token: ' + deviceToken); Ti.API.info('Successfully registered for push notifications!'); } function deviceTokenError(e) { alert('Failed to register for push notifications! ' + e.error); } var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); win.addEventListener('open', function() { // Register notification types to use Ti.App.iOS.registerUserNotificationSettings({ types: [ Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE ] }); }); win.open();Handled via TIMOB-26399