[AC-6496] Cannot obtain iOS Push token with registerForPushNotifications
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Appcelerator Studio 4.5.0 |
Fix Version/s | n/a |
Components | Alloy, Appcelerator CLI, Studio |
Labels | critical, ios, pushnotification |
Reporter | Pietro Granati |
Assignee | Abir Mukherjee |
Created | 2020-02-26T10:04:25.000+0000 |
Updated | 2020-06-18T14:25:56.000+0000 |
Description
SDK 8.3.1
I was working on an app with push notification using Firebase module.
Suddenly during testing the Firebase Admin SDK server side, iOS devices stops show notifications.
So I started investigate, the iPhone got iOS 13.3.1 update but seems to fire the token event correctly.
I go back to the pure deviceToken generation creating a new app and find out that registerForPushNotifications not even fire a callback!
This is the only code inside the app
var deviceToken = null;
// Wait for user settings to be registered before registering for push notifications
// Process incoming push notifications
function receivePush(e) {
alert('Received push: ' + JSON.stringify(e));
}
// Save the device token for subsequent API calls
function deviceTokenSuccess(e) {
Ti.API.info(JSON.stringify(e));
deviceToken = e.deviceToken;
}
function deviceTokenError(e) {
alert('Failed to register for push notifications! ' + e.error);
}
Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() {
Ti.API.error("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.registerUserNotificationSettings({
types: [
Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,
Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,
Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE
]
});
Yes the provisioning has the Push Notification enabled.
[~Pietro] We have fixed a similar issue in 9.0.0, TIMOB-27763. 9.0.0 RC is already there. Can you try on 9.0.0 and see if it works.