I've searched around the Internet and stack overflow and still can't solve this problem.
It is a tabbed application template.
When the app isn't running and it receives a push notification I want to read the contents of launchOptions from
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
which I do by parsing the JSON data etc...
I then want to display this on a separate view on storyboard.
I've read on some posts to do:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
DetailViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"Detail"];
[(UINavigationController*)self.window.rootViewController pushViewController:ivc animated:NO];
but this is giving me
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITabBarController pushViewController:animated:]: unrecognized selector sent to instance 0x1c5a0c20'
When the app is running in the background and it receives the push from
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)notification
I call [[NSNotificationCenter defaultCenter] postNotificationName:@"receivedPushNotification" object:self];
which tells whatever view is currently being displayed to
detail = [self.storyboard instantiateViewControllerWithIdentifier:@"Detail"];
[self.navigationController pushViewController:detail animated:YES];
which works fine.
The problem is none of these views are loaded when the app first launches so I need a way of putting the detail view controller on the users screen from appDelegate.
Thanks