How to create a reminder for some time, for example Remind me after 30 minutes on iPhone

Hi, I am working on a reminder app.

I need to display a reminder after a certain time.

But not at the time that we set in the date picker.

Just like I have a remind in 10 minutes button

-(IBAction)ReminderClick:(id)sender
{
}

When the user clicks the button, after 10 minutes he needs to display a warning.

+3
source share
2 answers

You need to use UILocalNotification for this function. The code looks like

UIApplication* app = [UIApplication sharedApplication];
        UILocalNotification* notifyAlarm = [[UILocalNotification alloc] init];

        NSDate *date1=[fire dateByAddingTimeInterval:60];
        notifyAlarm.fireDate = date1;
        notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
        //notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
        notifyAlarm.repeatInterval =NSWeekCalendarUnit ;
        notifyAlarm.soundName =soundString;
        notifyAlarm.alertBody =snoozeBody;
        notifyAlarm.userInfo=snoozeDict;
        //notifyAlarm.alertLaunchImage=@"in.png";
        [app scheduleLocalNotification:notifyAlarm]; 

and you can follow this tutorial for this http://www.icodeblog.com/tag/uilocalnotification/

http://blog.mugunthkumar.com/coding/iphone-tutorial-scheduling-local-notifications-using-a-singleton-class/

http://www.iostipsandtricks.com/ios-local-notifications-tutorial/

http://www.youtube.com/watch?v=tcVoq488-XI

+11

UILocalNotificataion

0

All Articles