SoFunction
Updated on 2025-04-09

iOS Click the push message to jump to the instance of the application specified page

iOS Click the push message to jump to the application specified page

Nowadays, push is used more and more frequently, and almost every application has begun to use it. In fact, how many users will watch push messages? There is no way, the product manager is the biggest, it just makes us a bunch of programmers suffer! Less gossip and get to the point. Brother, I use Aurora Push, so of course I take Aurora Push as an example.

Now clicking to push the message, there are two ways to jump: 1. Open the application and jump to the application homepage; 2. Open the application and jump to the specified page.

​The first type is that you don’t need to set anything, just register the Aurora app. I won’t write about how to register the Aurora application here. You can refer to the official document, which is written in detail.

​ The second type is the highlight.

// The content of the notification when the APP is not running remoteNotification is the content of the push sent by your server

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{​

NSDictionary *remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];​

// If remoteNotification is not empty, it means that there is a push and sent, the following is similar
if (remoteNotification) {

// Remove the icon in the upper right corner of the application. It is best to write it on, otherwise obsessive-compulsive disorder will be crazy
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

​       //​ Send a notice
​       [self performSelector:@selector(How to send notifications,The following are the same)withObject:remoteNotification afterDelay:1];

}

}​
// Receive push when the program is running. userInfo is the push content sent by your server.
- (void)application:(UIApplication *)application

didReceiveRemoteNotification:(NSDictionary *)userInfo {

// Required

[APService handleRemoteNotification:userInfo];

if (userInfo) {

[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

// Send a notification, the content of the notification is userInfo You can print it
}

}

- (void)application:(UIApplication *)application

didReceiveRemoteNotification:(NSDictionary *)userInfo

fetchCompletionHandler:(void

(^)(UIBackgroundFetchResult))completionHandler {

// IOS 7 Support Required

[APService handleRemoteNotification:userInfo];

completionHandler(UIBackgroundFetchResultNewData);

if (userInfo){

//​ Send a notice
}

}

The above three methods allow you to receive the push content sent by the server and send a notification in the main thread, otherwise you will not be able to receive it. If you want the app to jump to the homepage details page

- (void)viewDidLoad​{

// Add an observer​ How to make the program execute and jump to the details page
}​

If you want the application to jump to the third page details page, add:

_tabBarViewController.selectedIndex = 2;​

Thank you for reading, I hope it can help you. Thank you for your support for this site!