如何处理ios上的点击推送通知

moh*_*med 5 push-notification ios

我设法收到推送通知,但我不知道如何处理到达应用程序的推送通知的点击,我想根据通知类型告诉应用程序何时点击转到特定活动,而不仅仅是打开应用程序(默认行为)

我知道我可以收到

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{

    NSLog(@"Here I should Recive The notification .... ") ;
    //call the commented functions .....
}
Run Code Online (Sandbox Code Playgroud)

在此函数中,但是当我实现它时,通知不会出现,只是执行此函数中的操作

mor*_*oko 0

如果你想通过点击pushnotification来导航某些特定的ViewController只需在didReceiveRemoteNotification中添加ViewController导航代码

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{

NSLog(@"Here I should Receive The notification .... ") ;
//call the commented functions .....

FirstController *firstviewcontroller = [[FirstController alloc] initWithNibName:@"FirstController" bundle:nil];

    [self.navigationController pushviewcontroller:firstviewcontroller animated:YES];

}
Run Code Online (Sandbox Code Playgroud)