0

In my app , local notifications are displaying correctly. But,my doubt is,i need to redirect to specific screen in app while i'm slide the unlock to notification.

Pedro Mancheno
  • 5,237
  • 4
  • 24
  • 31
Ramdhas
  • 1,765
  • 1
  • 18
  • 26
  • Possible duplicate of [Deep Linking iOS Push Notifications](http://stackoverflow.com/questions/19105053/deep-linking-ios-push-notifications) – Pedro Mancheno Oct 16 '13 at 13:46
  • Its possible you need to do on your AppDelegate and implement the method **- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification;** – drasick Oct 16 '13 at 13:47
  • @drasick, already i used the same method. but don't know how to push to specific screen. – Ramdhas Oct 16 '13 at 13:54

2 Answers2

3

Do the below in app delegate.

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
   UIApplicationState state = [[UIApplication sharedApplication] applicationState];

   if (state != UIApplicationStateActive)
   {
      // redirect to the next screen.
   }
}

Hope it will help you.

Tapas Pal
  • 7,073
  • 8
  • 39
  • 86
1

Try this out,

You will get local notification in this method

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification;

or for remote notification

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

and after that you can push your screen i.e.

if(you are in another screen)
    push your required screen 
else 
    do nothing.
Siddh
  • 712
  • 4
  • 21
  • @user2776263 Suppose you are in background and you are in another screen when notification came then you are required to push your redirect screen. – Siddh Oct 16 '13 at 13:52
  • sure. but still i'm not clear about how to give condition in if condition. give sample condition in if condition.. – Ramdhas Oct 16 '13 at 14:00
  • @user2776263 what you have used in your app either navigationController or tabbarcontroller? – Siddh Oct 16 '13 at 14:04
  • both tabbarController and navigationController.. i used 5 tabs. when i slide it should move to 4 th screen of 2nd tab – Ramdhas Oct 16 '13 at 14:07
  • @user2776263 if[tabbarcontroller.selectedviewcontroller isKindofClass your class] then you are already there else tabbarcontroller. setselectedindex=1. Now, From tabbarcontroller.viewcontrollers you will get an array of navigationcontroller then create its mutable copy and then use object index 1 of an array and push your array of viewcontroller accordingly. – Siddh Oct 16 '13 at 14:50