universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

[ios] Notifications with same id sometimes don't hide previous ones #60

Closed zushiwarigan closed 6 years ago

zushiwarigan commented 7 years ago

When I schedule notifications with the same id multiple times in second then sometimes i'll receive not only the last but many of them. I've tried to add cancel before schedule - it doesn't help. It's rare but annoying case, i can't reproduce reliably. unity 5.6.2, utnotification updated in may (last version)

happens only on ios.

yuriy-universal-ivanov commented 7 years ago

Hi @zushiwarigan ,

Thank you, you're the second to report that issue recently, we're looking into fix currently and will let you know about solution as soon as we find it.

Please stay tuned and thank you for your patience.

Best regards, Yuriy, Universal Tools team.

zushiwarigan commented 7 years ago

Are you looking for fix or should we make fixes ourselves to get rid of this asap?

yuriy-universal-ivanov commented 7 years ago

Hi @zushiwarigan ,

The issue is our current priority number 1, we're working on it. The biggest trouble with it is that we are still unable to reproduce it even once in our tests. I've been keeping in touch with another customer facing the same issue, and with his help we narrowed it down to be sometimes non-working Unity's own UnityEngine.iOS.NotificationServices.CancelLocalNotification, which we're using internally on iOS to avoid duplicating scheduled notifications with the same id. Moreover, it seems to only be reproduced for the customer sometimes when fire date is not less than 6 hours in future. Unfortunately even knowing that, we're currently unable to reproduce it: scheduled notifications are never duplicated in either of our tests, though we're gonna keep looking into it.

It would be a huge help if you could create and send us a sample Unity project reproducing that issue and instructions on how exactly we can achieve it.

Best regards, Yuriy, Universal Tools team.

zushiwarigan commented 7 years ago

We don't have any repro ( It just happens rarely in the usual cases. But in our case it appears only when many schedule-cancel -schedul-cancel happen rapid one after another. Possible workaround is to make some queue and delay scheduling. Do you think it can work?

yuriy-universal-ivanov commented 7 years ago

@zushiwarigan ,

Not sure whether it may help or not: the other customer informed us that it may happen even when there are some pauses between re-scheduling/cancelling calls, and for us it's not reproduced even after hundreds of sequential and immediate operations like that.

zushiwarigan commented 7 years ago

any news?

yuriy-universal-ivanov commented 7 years ago

@zushiwarigan Unfortunately the issue has't been reproduced in any of our tests, not even once. We'd be happy to fix it as soon as we find out specific steps to reproduce it.

zushiwarigan commented 7 years ago

We can't reproduce it. It just happens sometimes. But not so rare. I think every active user will get it at least once in month or two. May be it is "heisenbug" and you'll never find a repro.

zushiwarigan commented 7 years ago

Хз что вам сказать, парни. Тестеры написали ещё про такой баг, что на иосе какие-то уведомления приходят как-то невовремя и сразу пачкой. Сел посмотреть ваш код.

планируем время notification.fireDate = System.DateTime.Now.AddSeconds(triggerInSeconds); видим, что ещё не енаблед и m_scheduledNotificationsWhenDisabled.Add(ToScheduledNotification(notification, DateTime.Now));

захожу в ToScheduledNotification

        if (notification.fireDate > now.ToUniversalTime())

почему время из now сравнивается с now.toUtc? сорри, конечно, если я тут чего-то не понял

yuriy-universal-ivanov commented 7 years ago

@zushiwarigan ,

Согласен, это явная ошибка, исправим. Каков ваш юзкейс при котором это проявляется? Планируете scheduled уведомления на несколько часов вперед (меньше, чем разница между UTC и локальным часовым поясом) при disabled уведомлениях, затем включаете их и получаете все эти уведомления одновременно и раньше запланированного срока?

Или как-то иначе?

И насчет дублирующихся уведомлений - может ли это у вас быть как-то связанным с disabled/enabled уведомлениями? (в наших тестах при попытке повторить эту багу, уведомления всегда были стабильно включены)

zushiwarigan commented 7 years ago

disable не используем, это никакой не кейс. Просто решил заглянуть в код, посмотреть что там, наткнулся на какую-то ошибку буквально в течение трёх минут, дальше ничего искать не стал. Полез, потому что тестеры доложили, что 4 уведомления от игры запланированных на разное время в будущем приходят не вовремя и почти одновременно именно на иосе.

zushiwarigan commented 7 years ago

а сегодня у тестеров именно на иосе уведомления приходят при запущенном приложении. а на андроиде такого нет.

yuriy-universal-ivanov commented 6 years ago

@zushiwarigan ,

Should be fixed in 1.7: https://assetstore.unity.com/packages/tools/integration/utnotifications-professional-local-push-notification-plugin-37767