iOS - Access SQLite DB and show notification every few days from the background


我的SQLite DB中有此内容。我需要在另一个之后透露每一块内容。

table screenshot




问题:从互联网上看其他来源,听起来并不像它一样(由Apple Dev表示):

This isn’t really the intended use case for background fetch. The idea behind background fetch is that the system learns when the user is using the app and, if the user is regularly using it at specific times, the system sends the app a background fetch event before that time so that it can refresh.




I don’t need an exact hour of execution, just that it happens on that day at all. Is it possible at all?

There is this sample code 使用后台任务重新编程和维护您的应用程序我发现的Apple,但它使用旧的应用程序委托结构,这有点难以追随,就像从SWIFTUI开始的人一样努力。

I’m not if I understand your concern about option (b). If the user doesn’t open the notification, the next scheduled one should still fire off on the desired schedule.ROB
But, as you’ve deduced, background fetch is not intended for this use-case. Besides, it is run at the sole discretion of the OS and you have no control over when it’s run (even what days). If user uses your app, it’s more likely to run more frequently, but if they don’t run your app, it will run less frequently.ROB
@ Rob问题是,无论用户是否打开它,仍应显示内容。如果他没有点击它,但稍后打开该应用程序,那么就不会有任何新内容。这将需要在启动和比较上进行双重逻辑检查与DB。big_chair
@ Rob,我不认为这是一个激进的,这是每2,3甚至5天的一个通知。而且它是一个自我改善的应用程序,频繁使用是任何进展的基础。但这将是另一个方法b),禁用一次,它永远不会揭示新内容。BIG_CHAIR
Re aggressiveness, once you lose someone, you’ve probably lost them forever, so it’s your call. Re “content should still be revealed regardless if whether user opens it or not”, I’m unclear where you’re revealing it if the user doesn’t tap on the notification and doesn’t launch the app. Perhaps you can edit your question and clarify…ROB

回答 0