Good time of day! In general, I ran into a problem, I received a notification, let's say "You received a new message", I need to open a chat with this user, but in order to get into the chat, you need to read 3 screens from the start page, or the user does not exit the application, but blocked the phone on the chat controller, please tell me how you need / can / will correctly open the desired controller? If you need to get to him through 3-9 lands? or not vice versa?

Thanks in advance for your help!

  • Oh question beautiful for plus. - BiMaWa
  • I don’t know if it’s still relevant, but if suddenly: you just need to navigate to a previously known controller, or do you need a previously unknown controller to open depending on the content of the push notification? - Max Mikheyenko

1 answer 1

I think it depends more on the application architecture. Here I have, for example, several NavigationControllers and everyone has a transition to the chat. Duck chat control accepts the model of interlocutors as input and so I can call it anywhere via push, having formulated all the data models for chat control before that.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { UINavigationController *navController = (UINavigationController *)self.window.rootViewController; NotificationViewController *notificationViewController = [[NotificationViewController alloc] init]; [navController.visibleViewController.navigationController pushViewController:notificationViewController]; } 

But in this example, I push immediately to chat without intermediate screens. If the task is to skip to where the chat went through the intermediate screen, then you need to come up with some kind of transition algorithm with a certain path of push screens with animation, with a block for completing the animation and pushing the next control in the path. In general, many options, in fact, it all depends on the TK.

  • @Bimawa At the moment there are 5 controllers, 0 - navigation, the rest are informational, all pass from 1 to 5, how can I open the chat so that the user can then return to 1 or 2 (to any controller)? - Zarochintsev
  • 2
    If the base controller is a UINavigationController, then you can set up an array of all controllers via the method: - (void) setViewControllers: (NSArray *) viewControllers animated: (BOOL) animated - BiMaWa
  • @Bimawa, And what kind of controller is this (NotificationViewController)? - Zarochintsev
  • This is a kind of controller in which you want to go .. For example chat. - BiMaWa
  • one
    @dev_nikita_ysacov What are you using? - Zarochintsev