In this specific case Sjakelien was using a Single View Application. The confusion was that the attempt to instantiate the ViewController
in AppDelegate
by doing the following ViewController * vc = [[ViewController alloc]init]; [vc loadURL];
did not work.
In this case the solution is the get the ViewController
that is displayed on screen by using
- (void) onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification {
ViewController *vc = (ViewController*)self.window.rootViewController;
[vc loadURL];
}
Applications with a different setup such as a UINavigationController
need to take different actions.
A few choices:
popToRootViewController and instantiate a new instance of
ViewController
and push it onto the navigation stackPush a new instance of
ViewController
onto the navigation stack without using popToRootViewController- Present the
ViewController
in a modal - Modify the model of the application