I've a simple News application consisted of a UINavigationController , UITableViewController and UIViewController , When the app launches it loads the news from the web and then when click on the table cell it goes to the other view to show the full article , I 've added push notifications But I want to handle it now so when the user clicks on the notification the View with the article appears and if the user clicked the back button it goes to the News List Table , Can Anyone help with this ?
in application:didFinishLaunchingWithOptions: you should take a look at what's in the launchOptions dictionary. Something like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
…
NSDictionary *userInfo = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
if ( userInfo != nil )
[self handlePushNotification: userInfo];
…
}
Don't forget to implement:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
in case the push notification comes while your app is running.
In your handlePushNotification: method, you should create your view stack manually, likely with animated: NO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With