Today's project uses a message to push the first time to do this aspect of the content first recorded.
When a third-party Aurora push is configured in accordance with Aurora's documentation, the project uses
When there is a push, you will receive push notifications from the server in the following ways, as well as push message content.
-(void) Networkdidreceivemessage: (nsnotification *) notification { *userinfo = [ Notification UserInfo]; *extras = userinfo[@ "extras"]; NSString *type = extras[@ "type"]; // nsstring *content = [userInfo valueforkey:@ "content"]; [self handleremotenotification:userinfo];//get push content, invoke method to handle push }
Handle push to determine the current state of the app
- (void) Handleremotenotification: (Nsdictionary *) userinfo{if(userinfo[@"_j_msgid"] || userinfo[@"content"]) {uiapplicationstate State=[UIApplication sharedapplication].applicationstate; if(state==uiapplicationstateactive | | state==uiapplicationstateinactive) {//at the front desk[[Nsnotificationcenter Defaultcenter]postnotificationname:r7_fetchremotenotificationnotifyObject: nil Userinfo:userinfo]; Supernavigationcontroller*navctrl = (Supernavigationcontroller *) [UIApplication Sharedapplication].keywindow.rootviewcontroller; Supertabcontroller*tabctrl= (supertabcontroller*) Navctrl.rootviewcontroller; [Tabctrl Dealwithpushinfo:userinfo applicationstate:state]; if(state==uiapplicationstateinactive) {[Apservice Setbadge:0]; [[UIApplication Sharedapplication]setapplicationiconbadgenumber:0]; } } Else if(State==uiapplicationstatebackground) {//notifications push to the background_userinfo=UserInfo; [Self addlocationremind]; } [Apservice Handleremotenotification:userinfo]; DLog (@"userinfo:%@", UserInfo); }}
- (void) Addlocationremind {globalsingle*single =[Globalsingle Sharedsingleinstace]; Nsinteger Discussdynamicnumber= [Single Numbertointwithkey:dynamicnumberkey] +1; [Single Savenumberwith:discussdynamicnumber Key:dynamicnumberkey]; NSDate*date = [NSDate datewithtimeintervalsincenow:5]; Uilocalnotification*note =[[Uilocalnotification alloc] init]; Note.alertbody=@"a reminder from Neuqer"; Note.alertaction=@"reply";//note.alertlaunchimage = @ "discuss_selected";Note.applicationiconbadgenumber =1; Note.soundname=Uilocalnotificationdefaultsoundname; Note.firedate=date; [[UIApplication sharedapplication] schedulelocalnotification:note];}
iOS Local notifications