3

i want to notify the user when a "time" is reached.

for example:

i have an tableview with many rows. this rows are something like reminders where the user can set the date and time of remind.
So in a row the reminder is set to 24 April 12:15.
At this time the App is closed.

So how can i notify the user that this time is reached?

Is there a way to do that without apple push notification service?

Edit 1:
Thanks for answering, here is an example for local notifications:

//This example adds 20 seconds to current time, use it for testing 
    UILocalNotification *localNotification = [[UILocalNotification alloc] init];



    NSDate *currentDate = [NSDate date];
    NSDate *currentDatePlus = [currentDate dateByAddingTimeInterval:20];

    localNotification.fireDate = currentDatePlus;
    localNotification.alertBody = @"Hallo ayFon User";
    localNotification.soundName = UILocalNotificationDefaultSoundName;

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
    [localNotification release];

EDIT 2:

//Add this for iOS 5 Notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: 
 UIRemoteNotificationTypeAlert |
 UIRemoteNotificationTypeSound];
brush51
  • 5,691
  • 6
  • 39
  • 73

2 Answers2

2

You have to use the Local Notifications of iOS. They are done in this exact purpose.

You can find documentation here: Local and Push Notification Programming Guide.

Arcank
  • 456
  • 5
  • 8
1

You don't have to use Push Notifications - you could use Local Notifications instead. They are similar to Push notifications except that they are generated on the device instead so you don't need a network connection.

This is a fairly common pattern for alarm type apps.

Abizern
  • 146,289
  • 39
  • 203
  • 257