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 ?
https://developer.apple.com/documentation/usernotifications/scheduling_a_notification_locally_from_your_app#2980225
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?
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?
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.
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
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
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
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
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/
thank you. Looks interesting let me dive into that
Обсуждают сегодня