Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift: how to schedule local notifications with dynamic content

I have a weather app for iOS, and I'd like to allow the user to receive a notification each morning at a time of their choosing which would fetch the weather forecast for the day and display a notification.

I'd like to avoid using push notifications, and I thought I might be able to use local notifications, except I can't see a way to fetch the content to be shown from a server. It looks like the content has to be set at the time of scheduling. Is that right?

That makes me think I might be able to register my application to use background execution to periodically fetch the weather and schedule a notification with the latest content, but this seems wasteful.

In short, I'd like to tell iOS to run a specific function at a specific time. Is there a good option for this that I'm missing? Are push notifications the only/best way to accomplish this sort of thing?

like image 806
Trevor Turk Avatar asked May 08 '17 04:05

Trevor Turk


1 Answers

Push notification is best option for your if you want to display weather forecast .

More about this : https://stackoverflow.com/a/41901767/3901620

like image 181
KKRocks Avatar answered Oct 18 '22 14:10

KKRocks