IOS Click Push message jump to apply specified page method _ios

Source: Internet
Author: User

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 sent 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 [Apservic

e 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;

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.