[AC-6406] iOS 13: registerForPushNotifications callback are not fired
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | ios-12, ios-13, notifications, push, sdk-8 |
Reporter | Andrea Vitale |
Assignee | Shak Hossain |
Created | 2019-10-14T16:56:31.000+0000 |
Updated | 2019-11-13T10:47:59.000+0000 |
Description
The _Ti.Network.registerForPushNotifications_ _success_, _error_ and _callback_ are not fired at all on iOS 13. The same code works well on iOS 12.4.3.
Here is the snippet:
if (OS_IOS) {
Ti.App.iOS.addEventListener('usernotificationsettings', function eventUserNotificationSettings() {
Ti.App.iOS.removeEventListener('usernotificationsettings', eventUserNotificationSettings);
Ti.Network.registerForPushNotifications({
success: successCallback,
error: errorCallback,
callback: notificationsCallback
});
});
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
]
});
}
You should use the
userNotificationSettings
for iOS 10+. The other one was deprecated back then and should only be used for backwards compatibility.I use it, I updated the issue with the entire code. Previously I only shared the code that doesn't work because if I put a Ti.API.info inside the _usernotificationsettings_ event callback I can see it.. what's wrong?
[Here](https://gist.github.com/hansemannn/f69e939563016bc56b92e6971284cbcf) is the push manager we use to register + listen to notifications. If it doesn't work with that one, the certificates you have will probably be the issue, but this is definitely no Titanium bug.
Hans thanks for your feedback! Unfortunately it is the same code that I have on my side. How can it be a certificate issue? On all devices with iOS 12.x push notifications works well. On devices with iOS 13 it doesn’t. Could [this](https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/) be related? UPDATE: tried to send a push notification to this iOS 13 device and the notification arrives but the callback is never fired. So this doesn't seem related to a certificate issue.
I'm seeing this same problem. Building with Xcode 11.1 (11A1027), no callback while registering for notifications. Building with Xcode 10.3, everything works fine.
Update: in my case, it was my fault as I was using SDK 8.1.1 and Xcode 11. Looking at the [Compatibility Matrix](https://wiki.appcelerator.org/display/guides2/Titanium+Compatibility+Matrix#TitaniumCompatibilityMatrix-SupportedversionsofXcode) after being told by Rene Pot it's clear I needed 8.2.0.