Devidas M Das Devidas M Das - 2 months ago 6x
iOS Question

How to show push notification at notificaion area iOS

I Have a

Arriving Like This,


"alert" : "You got your emails.",

"badge" : 9


I want to instantly display this array in notification tray of iphone | ipad

If you anybody have know Please Answer.
Thanks in Advance


Use below Library to show notification in Navigation Bar


An in-app notification view that mimics the iOS 6 notification views which appear above the status bar.


Animation and layout similar to iOS 6 notifications

Provides two UILabels and an UIImageView

Simple API

Enqueues multiple notifications and shows them with a default duration of 2 seconds.

enter image description here

And if You want to get Notification, YOu have to do few code in Appdelegate.m File As given Below

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];


#pragma mark Notification tokan

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    deviceTokenForPushNotification  = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
    deviceTokenForPushNotification = [deviceTokenForPushNotification stringByReplacingOccurrencesOfString:@" " withString:@""];

    NSUserDefaults *objUserDefalut = [NSUserDefaults standardUserDefaults];
    [objUserDefalut setValue:deviceTokenForPushNotification forKey:@"DeviceToken"];
    [objUserDefalut synchronize];

    NSLog(@"My token is: %@", deviceToken);

- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error

    NSUserDefaults *objUserDefalut = [NSUserDefaults standardUserDefaults];
    [objUserDefalut setValue:@"" forKey:@"DeviceToken"];
    [objUserDefalut synchronize];