1 First step: Create a local push2 //Create a local push3Uilocalnotification *notification =[[[ Uilocalnotification alloc] init] autorelease];4 //set after 10 seconds5NSDate *pushdate = [NSDate datewithtimeintervalsincenow:Ten];6 if(Notification! =Nil) {7//Set push Time8Notification.firedate =pushdate;9//Setting the time zoneTenNotification.timezone =[Nstimezone Defaulttimezone]; One//set the recurrence interval ANotification.repeatinterval =Kcfcalendarunitday; -//Push Sound -Notification.soundname =Uilocalnotificationdefaultsoundname; the//Push Content -Notification.alertbody =@"Push Content"; -//The number of the red circle displayed on the icon -Notification.applicationiconbadgenumber =1; +//Setup UserInfo is convenient to use when you need to undo later -Nsdictionary *info = [Nsdictionary dictionarywithobject:@"name"Forkey:@"Key"]; +Notification.userinfo =info; A//add push to UIApplication atUIApplication *app =[UIApplication sharedapplication]; - [app Schedulelocalnotification:notification]; - - } - - Step two: Receive local push in- (void) Application: (UIApplication *) application didreceivelocalnotification: (uilocalnotification*) notification{ -Uialertview *alert = [[Uialertview alloc] Initwithtitle:@"IWeibo"Message:notification.alertBodyDelegate: Nil Cancelbuttontitle:@"Determine"Otherbuttontitles:nil]; to [alert show]; +//the number on the icon minus 1 - 1. Application.applicationiconbadgenumber-=1; the } * $ step three: unblock local pushPanax Notoginseng //Get UIApplication -UIApplication *app =[UIApplication sharedapplication]; the //get local push array +Nsarray *localarray =[app Scheduledlocalnotifications]; A //declaring a local notification object theUilocalnotification *localnotification; + if(LocalArray) { - for(Uilocalnotification *notiinchLocalArray) { $Nsdictionary *dict =Noti.userinfo; $if(dict) { -NSString *inkey = [Dict objectforkey:@"Key"]; -if([Inkey isequaltostring:@"the corresponding key value"]) { theif(localnotification) { - [localnotification release];WuyiLocalnotification =Nil; the } -Localnotification =[Noti retain]; Wu Break; - } About } $ } - -//determine if a push is found for the same key that already exists -if(!localnotification) { A//There is no initialization +Localnotification =[[Uilocalnotification alloc] init]; the } - $if(localnotification) { the//do not push cancel push the [app Cancellocalnotification:localnotification]; the [localnotification release]; thereturn; - } in } the the The process is probably like this. About 1. Build certificatesigningrequest.certsigningrequest file the 2. Upload certificatesigningrequest.certsigningrequest into developer, export the. cer file the 3. Export P12 files with CSR the 4the device token value needs to be prepared (no spaces) + 5. Use the push certificate used by the OpenSSL compositing server
Local Push Simple Code Demo