Call Alarm for a specific time in ios

I am working on an App that will set an alarm on ios for a while depending on user input.

Meaning: if the user selects row 1 of the table, then he will look for a dictionary (which can say 20 minutes), then he should set the alarm in ios (real-time time + 20 minutes).

Can someone please tell me how best to approach this.

+4
source share
1 answer

You can use UILocalNotification:

UILocalNotification *local = [[UILocalNotification alloc] init]; // create date/time information local.fireDate = [NSDate dateWithTimeIntervalSinceNow:20*60]; //time in seconds local.timeZone = [NSTimeZone defaultTimeZone]; // set notification details local.alertBody = @"Alarm!"; local.alertAction = @"Okay!"; local.soundName = [NSString stringWithFormat:@"Default.caf"]; // Gather any custom data you need to save with the notification NSDictionary *customInfo = [NSDictionary dictionaryWithObject:@"ABCD1234" forKey:@"yourKey"]; local.userInfo = customInfo; // Schedule it! [[UIApplication sharedApplication] scheduleLocalNotification:local]; [local release]; 
+4
source

All Articles