I have creating local notification process using objective C for iPhone application. I want to pass the data after didReceiveLocalNotification
to Main view controller.
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
if (app.applicationState == UIApplicationStateInactive ) {
NSLog(@"app not running");
// I need to pass the data to main view controller
}else if(app.applicationState == UIApplicationStateActive ) {
NSLog(@"app running");
// I need to pass the data to main view controller
}
NSLog(@"Recieved Notification %@",notif); // Handle the notificaton when the app is running
}
you can use NSNotificationCenter to pass data.
in MainViewController.m
in
viewDidLoad
in AppDelegate
you can pass string in
[[NSNotificationCenter defaultCenter] postNotificationName:@"notifMainController" object:@"your string"];
like this in object. Maybe this will help you.