In appdelegate to determine whether the app is from the push-in, if it is to use the content of the message
Nsnotification register a notice and then go to the home to receive this notification to determine the message content and jump to the page has been stuck in the home there is a jump delay caused by the jump but go if not successful add a delay to let the notification delay 0.5 seconds to receive time to see the actual situation uh, first. Because it takes a little too long before it's just a test used to kill the code later, it's erased.
I don't know if this is the first post.
-(void) application: (uiapplication*) Application didreceiveremotenotification: (nsdictionary*) UserInfo Fetchcompletionhandler: (void (^) (uibackgroundfetchresult)) completionhandler{//NSLog (@ "Receive push%@", userInfo); [Apservice Handleremotenotification:userinfo]; NSDateFormatter *datefor = [[NSDateFormatter alloc] init]; Datefor.dateformat = @ "Yyyymmddhhmmsssss"; NSDate *date = [NSDate Date]; NSString *time = [Datefor stringfromdate:date]; Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (1 * nsec_per_sec)), Dispatch_get_main_queue (), ^{if (![ userinfo[@ "APS"][@ "alert"] isequaltostring:@ "offline payment Success"]) {[Model manager] insertmessage:userinfo[@ "APS"][@ "ale RT "] anstate:@" 0 "Timedate:time userid:[[nsuserdefaults standarduserdefaults] objectforkey:@" userid "]; Nsnotification *not1 =[nsnotification notificationwithname:@ "Xiaoxi" Object:nil Userinfo:userinfo]; [[Nsnotificationcenter Defaultcenter] postnotification:not1]; }else {[Model manager] insertmessage:userinfo[@ "APS"][@ "alert"] anstate:@ "1" timedate:time userid:[[n Suserdefaults Standarduserdefaults] objectforkey:@ "userid"]; Nsdictionary *dic = @{@ "content": userinfo[@ "APS"][@ "Alert"]}; Nsnotification *not =[nsnotification notificationwithname:@ "XianXia" Object:nil userinfo:dic]; [[Nsnotificationcenter Defaultcenter] postnotification:not]; } }); Nsarray *arr = [[Model manager] selectstate:@ "1" userid:[[nsuserdefaults Standarduserdefaults] objectforkey:@ "userid"] ]; [[UIApplication sharedapplication] setApplicationIconBadgeNumber:arr.count]; Completionhandler (uibackgroundfetchresultnewdata);}
Record click Push to enter app to go directly to a page