What do do with Notifications when UIApplicationStateActive

I have set up an app that is registered for remote notifications.

- (void)application:(UIApplication*)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
    NSString *status = [NSString stringWithFormat:@"Notification Received:\n%@",userInfo.description];

    UIAlertView *alert=[[UIAlertView alloc] 
    alert.tag = kAlertTypeNotification;
    [alert show];
    [self vibrate];

if ( application.applicationState == UIApplicationStateActive ) {
    // app was already in the foreground

else {
    // app was just brought from background to foreground


So, when the app is not active, i get that really nifty banner alert, that looks so nice on the iPhone.

However, when the app is open, the only option I seem to have is to present a UIAlertView. This is intrusive in my opinion. Is there a way I can display the banner while application.applicationState == UIApplicationStateActive? Or, is there an open source library that implements this kind of feature?

Thanks for all your help!


You can do whatever you want when the app is in the foreground. Who says you have to display a UIAlertView?

I've asked this question more directly here:

Displaying a stock iOS notification banner when your app is open and in the foreground?

The short answer is that as of iOS 9, you cannot show the stock iOS banner when your app is in the foreground.

You will instead have to rely on a home-built or 3rd-part notification banner.

Please duplicate this radar requesting this feature: rdar://22313177

Need Your Help

Refactoring with generics

c# generics

Let's assume, that we have the following classes:

wget: don't follow redirects

linux http bash redirect wget

How do I prevent wget from following redirects?