//Send Notifications
uilocalnotification *notification=[[uilocalnotification alloc] init];
if(notification!=nil) {
nsdate *now=[nsdateNew];
Notification.firedate=[now Datebyaddingtimeinterval:Ten];//notify after 10 seconds
notification.repeatinterval=0;//cycle times, Kcfcalendarunitweekday once a week
Notification.timezone=[nstimezone Defaulttimezone];
notification.applicationiconbadgenumber=1; //Applied Red number
notification.soundname= Uilocalnotificationdefaultsoundname;//Sound, can be replaced by Alarm.soundname = @ "MYMUSIC.CAF"
//remove the following 2 lines without prompting the popup box
notification.alertbody=@"Notification Content";//prompt Message pop-up prompt box
notification.alertaction =@"Open"; //Prompt Box button
//notification.hasaction = NO;//If the extra button is displayed, the alertaction disappears when no
//nsdictionary *infodict = [nsdictionary dictionarywithobject:@ "somevalue" forkey:@ "Somekey"];
//notification.userinfo = infodict;//Add additional information
[[UIApplication sharedapplication] schedulelocalnotification:notification];
}
[Notification release];
Cancel Notification
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions { /c3>
//Override point for customization after application launch.
Application.applicationiconbadgenumber =0;
//ADD The View controller ' s view to the window and display.
[window AddSubview:viewController.view];
[window makekeyandvisible];
returnYES;
}
- (void) Application: (UIApplication *) application didreceivelocalnotification: (uilocalnotification *) Notification {
//Click Open in the Prompt box
Application.applicationiconbadgenumber =0;
}
- (void) Applicationdidbecomeactive: (uiapplication *) application {
//when the program is still running the day after Tomorrow
Application.applicationiconbadgenumber =0;
}