Sending Local Notifications in iOS

Want to learn how to send local notifications in IOS? Vizteck is giving you a step-by-step detailed guide for it.


Software Development Services


May 5, 2014


Mah Noor



A local notification is a way of notifying users without any Internet and server-side implementation. You can specify the date and time when a particular notification will be delivered. Local notifications in iOS are used to notify users by text, sound, or calendar event when the app is not running in the foreground.







PURPOSE | What are we Trying to do?

Click a button to send a notification that will be delivered after 30 seconds.

IMPLEMENTATION | Sending Notifications.


Receiving Local Notifications

In AppDelegate.m you need to reset the app icon count to 0 when local notifications are read so replace the didFinishLaunchingWithOptions method with the below code.

 - (BOOL)application: (UIApplication*) application didFinishLaunchingWithOptions: (NSDictionary*) launch options


UILocalNotification* localNotification =

[launchOptionsobjectForKey:  UIApplicationLaunchOptionsLocalNotificationKey]; 

if (local notification)

{ application.applicationIconBadgeNumber = 0; } returnYES; }  

Local notifications are only received when your app is not running in the foreground. If you want to show a notification in the alert when the app is active (in the foreground state) then add the below method.

 - (void) application: (UIApplication*) application didReceiveLocalNotification: (UILocalNotification*) notification


UIApplicationState currentState = [application applicationState]; 

if (currentState == UIApplicationStateActive) 


 UIAlertView *notificationAlert = [[UIAlertViewalloc] initWithTitle: @"Local Notifications" 

message:@"You have a notification. please check"delegate:selfcancelButtonTitle:@"OK" otherButtonTitles:nil];

 [notificationAlert show];


 application.applicationIconBadgeNumber = 0; } 

Run your project and click send notification button to Schedule a notification after 30 seconds.


Islamabad, Pakistan

Floor 2, Building 145, Civic Center Bahria Town Phase 4, Islamabad, Pakistan


1 squire armor road, windham, NH,03076

Saudi Arabia

7654 Prince Nawaf Street, Al Khobar, 34426

Kingdom Of Bahrain

No 851, Bldg No 2420, Rd No 2831, Seef District, Block 428