wemblem
wemblem

Reputation: 139

Set a task for a certain date (iOS app)

Assume that I create a task today, and say that I want to be reminded of it (via a push notification) 10 days from today. Essentially, how do I constantly keep track of what day it is (even when my app isn't actively being used) to finally recognize when it becomes 10 days from today?

Upvotes: 0

Views: 69

Answers (1)

Fogmeister
Fogmeister

Reputation: 77651

You don't do this.

You would schedule the notification for when it is supposed to happen like this...

UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.fireDate = [NSDate someDateInTheFuture];
notification.alertBody = @"This is your alert. Do something";
notification.alertAction = @"Alert";

[[UIApplication sharedApplication] scheduleLocalNotification:notification];

The notification will then fire when it gets to the date that you set. You don't have to check for it yourself in the app. It just happens.

Upvotes: 1

Related Questions