Uilocalnotification *notification=[[uilocalnotification alloc] init];
if (Notification!=nil)
{
NSDate *now=[nsdate New];
Notification.firedate=[now Addtimeinterval:period];
Notification.firedate = [now datebyaddingtimeinterval:period];
NSLog (@ "%d", period);
Notification.timezone=[nstimezone Defaulttimezone];
Notification.soundname = @ "PING.CAF";
Notification.alertbody[email protected] "time! ";
Notification.alertbody = [NSString stringwithformat:@ "@% time is up!", NAMESTR];
nsdictionary* info = [nsdictionary dictionarywithobject:uniquecodestr forkey:code];
Notification.userinfo = info;
[[UIApplication sharedapplication] schedulelocalnotification:notification];
}
When the time is up, a prompt will pop up on the desktop and the software can be started after the point is displayed. And then in
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
{
Uilocalnotification *localnotif = [Launchoptions Objectforkey:uiapplicationlaunchoptionslocalnotificationkey];
if (localnotif)
{
NSLog (@ "recieved Notification%@", localnotif);
nsdictionary* infodic = Localnotif.userinfo;
NSLog (@ "UserInfo description=%@", [infodic description]);
nsstring* codestr = [Infodic Objectforkey:code];
}
}, the lanchoptions is processed, find the information inside it, you can get the settings need to deal with things, you can continue to operate.
If your client software is still open at this point, it will call the
-(void) Application: (UIApplication *) app Didreceivelocalnotification: (uilocalnotification *) Notif
{
}
The same treatment method.
iOS Alarm Clock implementation