IOS Click Push message skip to application specified page
Now the push is more and more frequent, almost every application is beginning to use. In fact, how many users will go to see the push message? No way, product manager biggest Ah, just bitter we this a bunch of programmers ah! Gossip less and get to the point. My brother I used the Aurora push, which is naturally an example of the Aurora push.
Now click on the push message, there are two ways to jump: 1. Open the application, jump to the application homepage; 2. Open the application and jump to the specified page.
First, you don't need to set anything, just sign up for Aurora applications. Here is not to write how to register the Aurora application, you can refer to the official document, written in detail.
The second, the play is coming.
Get notification content when app is not running remotenotification is what your server sends push
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions{
Nsdictionary *remotenotification = [Launchoptions Objectforkey:uiapplicationlaunchoptionsremotenotificationkey]; If the remotenotification is not empty, the representative has a push communicated over, the following similar if (remotenotification) {//To remove the icon in the top right corner of this is best written, otherwise obsessive-compulsive disorder will be crazy [UIApplication sha Redapplication].applicationiconbadgenumber = 0;//notification [self Performselector: @selector (the same method for sending notifications, below) wit
Hobject:remotenotification Afterdelay:1]; When the program runs, it receives the push UserInfo is the content of the push sent by your server-(void) Application: (UIApplication *) Application Didreceiveremotenotification
:(Nsdictionary *) userInfo {//Required [Apservice handleremotenotification:userinfo];
if (userInfo) {[UIApplication sharedapplication].applicationiconbadgenumber = 0; Send a notice, the notice content is userinfo you can print a moment}-(void) Application: (UIApplication *) application didreceiveremotenotification: (NSDI Ctionary *) UserInfo Fetchcompletionhandler: (void (^) (uibackgroundFetchresult)) Completionhandler {//IOS 7 Support Required [Apservice handleremotenotification:userinfo];
Completionhandler (Uibackgroundfetchresultnewdata);
if (userInfo) {//Send notification}}
The above three methods, you can receive the server sent over the push content, in the main thread to send a notice, otherwise receive. If you want the application to jump to the details page of the homepage
-(void) Viewdidload {
//Add observer to allow program to execute jump to detail page method
}
If you want the application to jump to the third page of the Details page, add in the method of sending the notification:
_tabbarviewcontroller.selectedindex = 2;
Thank you for reading, I hope to help you, thank you for your support for this site!