iOS - Немногие устройства нового поколения с ОС 13 и Urban Airship Upgrade версии 13 не получают уведомления pu sh на переднем плане - PullRequest
0 голосов
/ 24 марта 2020

Я обновил существующий iOS Проект для поддержки iOS 13 с обновлением Urban Airship до версии 13. Немногие устройства могут получать уведомление Pu sh. Но некоторым устройствам не повезло.

Тестовые уведомления принимаются правильно, если токен устройства / идентификатор канала предоставлен на портале Urban Airship. Но когда я выполняю какие-то действия в приложении, которое должно вызывать уведомление на подключенные устройства.

Многие методы устарели в Urban Airship SDK 13. Заменены предоставленными API. Ниже мой метод AppDelegate "didFinishLaunchOption" с кодом настройки Urban Airship.

 -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
         UAConfig *config = [UAConfig defaultConfig];
         [UAirship takeOff:config];
         UAirship.push.pushNotificationDelegate = self.pushNotificationReceiver;
         UAirship.push.registrationDelegate = self;
        [UAirship.push resetBadge];
        [UAirship push].notificationOptions = (UANotificationOptionAlert | UANotificationOptionBadge | UANotificationOptionSound);
        UAirship.push.defaultPresentationOptions = (UNNotificationPresentationOptionBadge |
                                                        UNNotificationPresentationOptionSound |
                                                        UNNotificationPresentationOptionAlert);
        [UAirship.push updateRegistration];
       return YES;
    }

// Класс PushNotificationReceiver // Метод делегата из UAPushNotificationDelegate

 - (void)receivedForegroundNotification:(UANotificationContent *)notificationContent completionHandler:(void (^)(void))completionHandler {

    // Custom alert view used to show push notification contents with two buttons. So completion handler not called here. If called then notification banner displayed on status bar in foreground.

        NSDictionary *dict = notificationContent.notificationInfo;
        [self receivedForegroundNotification:dict];
    }
...