There's really no reason to pass the didReceiveNotification around the application. It's intended to be handled once; that being said, I'm rather unsure of why you'd want to pass a delegate around.
If you want to push a view controller above everything else (I have no clue about your View hierarchy, so I have no idea if this is really something you would use), you could perhaps do something like:
[[self.window rootViewController] presentViewController:[[ViewControllerB alloc] initWithNib:@"ViewControllerB" bundle:nil] animated:YES completion:^{}];
This code is just throwing a modal view on top of everything.
Or if for some reason, you do need to handle the notification in more places than just the application delegate, there's two things you can do:
Delegate Model
Create a new delegate protocol in the AppDelegate header, and set this to whatever handler you wish - the down side to this is (as has been mentioned above) is that only one object can listen to the delegate at a time
@protocol MyNotificationDelegate <NSObject>
@required
-(void) applicationDidReceiveRemoteNotification: (NSDictionary*)userInfo;
@end
Post a Notification
As many objects as you like can listen for this notification; in the object you want to listen:
AppDelegate *appDel = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"ReceivedNotification" object:appDel];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationReceived:) name:@"ReceivedNotification" object:appDel];
And add the function:
-(void)notificationReceived :(NSNotification *)localNot{
NSLog(@"userInfo from push: %@",localNot.userInfo );
}
On your application delegate callback:
- (void)application:(UIApplication*)application didReceiveRemoteNotification: (NSDictionary*)userInfo{
NSLog(@"Received notification: %@", userInfo);
[[NSNotificationCenter defaultCenter] postNotificationName:@"ReceivedNotification" object:self userInfo:userInfo];
}