185 похожих чатов

Hi. I am working on an educational app. I want

to send a notification to the user how long he studied every day at 22:00 and clear that time. Unfortunately iOS does not provide me anything like notification sent or not. I wanted to ask you guys have you encountered such problem? If yes how did you solve this ?

17 ответов

15 просмотров

https://developer.apple.com/documentation/usernotifications/scheduling_a_notification_locally_from_your_app#2980225

HOGGISH- Автор вопроса

Thank you for the link to the documentation. I have read this. And I want to know whether this kind of problem occured to someone or not. If yes how did they overcame this problem.

sorry cannot get the problem. do u just wanna track that user received this notification?

HOGGISH- Автор вопроса

yes

did u try this one https://stackoverflow.com/questions/32061897/ios-push-notification-how-to-detect-if-the-user-tapped-on-notification-when-the ? or it needs to track without tap?

HOGGISH- Автор вопроса

didReceive works on taps only. I am sending the time that the user studied every day at specific time. And when the user receives the notification I want to clear the cache.

HOGGISH- Автор вопроса

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)

hmmm, probably it’s not possible. but you can try to write studying time duration with a date. Check user last time studying and dayComponent of date is < current day -> clear and do it every app launching

HOGGISH- Автор вопроса

yeah thank you for the suggestion and you time Andrii. I was doing the same for the past months but users send me report to the bug that. If they dont enter to the app after 22:00 the day after app sends them the time they listend yesterday this is the problem)

okay, lets do this one still check it every app launching and also check it when you send notification

HOGGISH- Автор вопроса

how do you check before sending the notificaiton ?) if that is possible that would be great

just get your StudyingTime data, compare with current date and send cleared or just not send notification, if no info for current day

HOGGISH- Автор вопроса

thank you Andrii. Yeah I tried this one too. The problem is when UNUserNotificationCenter.current().add(request) using this the time will be called once and never will be called after that. And that time will be called when you are adding the notification the the center

in theory you can schedule a background task to update your app’s cache after the notification appeared

HOGGISH- Автор вопроса

thank you. How is that possible ? Could you please tell me the ways ?

not sure, try this, and set earliestBeginDate after the time your notification is supposed to fire https://www.andyibanez.com/posts/modern-background-tasks-ios13/

HOGGISH- Автор вопроса

thank you. Looks interesting let me dive into that

Похожие вопросы

Обсуждают сегодня

Вопрос по диагностике ошибок (я знаю в чем, в данном конкретном примере, я знаю, как исправить, пример модельный, понятно, что в реальности бывает намного запутаннее). module...
ⰄⰎⰋⰐⰐⰑⰛⰤⰧⰧⰩⰄ ⰊⰑⰁⰓⰡⰛⰦⰕⰫ
10
А чем вам питонисты не угодили?😂
.
79
Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
48
Есть предложения, как подобное можно упростить?
Hemul GM
12
type TObj = object procedure Init; virtual; end; TObj1 = object(TObj) procedure Init; override; end; procedure TObj1.Init; begin inherited; end; procedur...
Alexander 👋
29
У меня вопросик назрел. Почему, создав класс без наследования и реализации деструктора Destroy, деструктор не вызывался при free. Потом указал наследование от tobject и overri...
Сергей Бычков
9
Такой вопросец - есть функция function MySuperDuperConcat(const a: array of AnsiString): AnsiString; Как мне в её теле сделать вот так? Result:=Concat(a); А не грустный вариан...
notme
15
just use free version ?? pycharm has a free version
Fan / Ac
9
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
86
Привет, не могли бы подсказать почему "A tree falls in a forest" не отображается в journalctl? openlog ("exampleprog", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); syslog (LO...
•_• Asmanov 🎓
3
Карта сайта