NSDate now = [NSDate Date];
//Get system time
Nscalendar calendar = [[Nscalendar alloc] Initwithcalendaridentifier:nscalendaridentifiergregorian] ;
Nsdatecomponents *components = [[Nsdatecomponents alloc] init];
Nsinteger unitflags = Nscalendarunityear | Nscalendarunitmonth | Nscalendarunitday | Nscalendarunitweekday | Nscalendarunithour | Nscalendarunitminute | Nscalendarunitsecond;
Components = [Calendar components:unitflags Fromdate:now];
Nsinteger hour = [Components hour];
Nsinteger min = [Components minute];
Nsinteger sec = [Components second];
Nsinteger week = [Components weekday];
NSLog (@ "Now%ld:%ld:%ld, Week%ld", Hour,min,sec,week);
Uilocalnotification *localnotification = [[Uilocalnotification alloc] init];
Set the time zone (following the cell phone's time zone) Localnotification.timezone = [Nstimezone defaulttimezone];
if (localnotification) {localnotification.alertbody = @ "message push message push";
Localnotification.alertaction = @ "OPEN";
Small icon Number Localnotification.applicationiconbadgenumber = 0;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[Formatter setdateformat:@ "HH:mm:ss"];
NSDate *date = [Formatter datefromstring:@ "15:30:00"];
The time Localnotification.firedate = Date of the notice issued;
}//cyclic notification cycle localnotification.repeatinterval = Kcfcalendarunitday;
Set UserInfo to facilitate the revocation of nsdictionary *info = [nsdictionary dictionarywithobject:@ "name" forkey:@ "Key"];
Localnotification.userinfo = info;
Start task [[UIApplication sharedapplication] schedulelocalnotification:localnotification]; *////* for (uilocalnotification *obj in [uiapplication sharedapplication].scheduledlocalnotifications) {if ([Obj.userI Nfo.allkeys Containsobject:klocalnotIficationkey]) {[[UIApplication sharedapplication] cancellocalnotification:obj];
}//Set a local push at a fixed time nsdate *now = [NSDate Date];
Obtain system time Nscalendar *calendar = [[Nscalendar alloc] Initwithcalendaridentifier:nscalendaridentifiergregorian];
Nsdatecomponents *components = [[Nsdatecomponents alloc] init]; Nsinteger unitflags = Nscalendarunityear | Nscalendarunitmonth | Nscalendarunitday | Nscalendarunitweekday | Nscalendarunithour | Nscalendarunitminute |
Nscalendarunitsecond;
components = [Calendar components:unitflags Fromdate:now];
Nsinteger hour = [Components hour];
Nsinteger min = [Components minute];
Nsinteger sec = [Components second];
Nsinteger week = [Components weekday];
Wdlog (@ "Now is%ld:%ld:%ld, Zhou%ld", Hour,min,sec,week);
Uilocalnotification *localnotification = [[Uilocalnotification alloc] init];
Set the time zone (following the cell phone's time zone) Localnotification.timezone = [Nstimezone defaulttimezone];
if (localnotification) {localnotification.alertbody = @ "message push message push"; LocalnotificatIon.alertaction = @ "OPEN";
Small icon Number Localnotification.applicationiconbadgenumber = 0;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[Formatter setdateformat:@ "HH:mm:ss"];
NSDate *date = [Formatter datefromstring:@ "15:30:00"];
The time Localnotification.firedate = Date of the notice issued;
}//cyclic notification cycle localnotification.repeatinterval = Kcfcalendarunitday;
Set UserInfo to facilitate the revocation of nsdictionary *info = [nsdictionary dictionarywithobject:@ "name" forkey:@ "Key"];
Localnotification.userinfo = info;
Start task [[UIApplication sharedapplication] schedulelocalnotification:localnotification]; *////* for (uilocalnotification *obj in [uiapplication sharedapplication].scheduledlocalnotifications) {if ([Obj.userI Nfo.allkeys Containsobject:klocalnotificationkey]) {[[UIApplication sharedapplication] CancelLocalNotification:ob
J]; }///Cancel all local notifications directly//[[uiapplication Sharedapplication] cancelalllocalnotifications];