I have a small problem in Push notification Service in iphone.
I have implemented the push notification in iphone and it works very well.
My problem is that
APPLICATION CLOSE-when my app is closed and when I get notification alert, On click of view button of notification I go to my alert view page.
On that alert page I have a back button when I click it,I go to my other page which is fixed.
APPLICATION ON- when my app is on and i am in one of my page.And notification alert comes, On click of view button of notification I go to my alert view page same as above.
But now when I click back button I want to go the previous page where I was before notification. Not on fixed page as when app is closed.
How should I do this in iphone?
Please share your logic / idea to resolve my problem?
Every time you are directed from the notification, replace your navigation stack.
Let’s assume that
FirstViewControlleris where you want to be back after clicking the backbutton. AndSecondViewControlleris where you want to go when clicking on the alert.So each time you are refering from notification, replace your navigation stack by
As the you pop back from the presented view you will always get the
FirstViewController.The above one is for the situation when your app is not in background (or CLOSED).
For the condition which your app is in background and when you receive the notification,
From the AppDelegate
application:didReceiveRemoteNotification:you can push the view just as you push normally. Then it will return back to the previous page that you are in before you got the notification.(In the assumption that you are using the global navigation controller through out the whole project)Glad if this helps you in anyway.