Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6406] iOS 13: registerForPushNotifications callback are not fired

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsios-12, ios-13, notifications, push, sdk-8
ReporterAndrea Vitale
AssigneeShak Hossain
Created2019-10-14T16:56:31.000+0000
Updated2019-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
                ]
            });
        }

Comments

  1. Hans Knöchel 2019-10-14

    You should use the userNotificationSettings for iOS 10+. The other one was deprecated back then and should only be used for backwards compatibility.
  2. Andrea Vitale 2019-10-15

    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?
  3. Hans Knöchel 2019-10-15

    [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.
  4. Andrea Vitale 2019-10-16

    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.
  5. Diego Freniche 2019-11-12

    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.
  6. Diego Freniche 2019-11-13

    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.

JSON Source