Set up UILocalNotification in iOS Swift/Objective C

Set up UILocalNotification in iOS Swift/Objective C


UILocalNotification helps to schedule specific notification for the user on specific date & time. As the name suggests that its handled & called from inside the application locally. So it can work without internet connection.

Its used in an application for various purpose like :

  • Keeping user active into application & make sure app usage increases
  • Notify for some reminders in the application
  • Used as a reminder feature inside the application
  • Keep highlighting for the features inside the application
  • Daily usage reminder for the application

So here is the tutorial about how we can create a UILocalNotification & manage it.

Objective C :


Create new notification :

-(void)doCreateLocalNotification {

NSDate *now = [NSDate date];

NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];

NSDateComponents *components = [calendar components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay fromDate:now];

[components setHour:18];

[components setMinute:1];

[components setSecond:10];

NSDate *firedate = [calendar dateFromComponents:components];

UILocalNotification *notification = [[UILocalNotification alloc] init];

notification.fireDate = firedate;

notification.alertBody = @”Hey how are you ? Have you used application today ?”;

notification.repeatInterval = NSCalendarUnitDay;

[[UIApplication sharedApplication] scheduleLocalNotification:notification];


Destry all local notifications :

-(void)doDestryNotification {

[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];

[[UIApplication sharedApplication] cancelAllLocalNotifications];


Read more: Healthy iOS Development Tips & Tricks

Swift :


Create new notification :

func doCreateReminder() {

let dateToFire = NSDate().addingTimeInterval(60*60*24*7)

let notification = UILocalNotification()

notification.fireDate = dateToFire as Date

notification.alertBody = NSLocalizedString(“localalert”, comment: “”)

let dict:NSDictionary = [“type” : “reminder”]

notification.userInfo = dict as! [String : String]

notification.repeatInterval = NSCalendar.Unit(rawValue: UInt(0))

notification.soundName = UILocalNotificationDefaultSoundName



Destry all local notifications :

func doDestryAllNotification() {

UIApplication.shared.applicationIconBadgeNumber = 0




Tags: iOS, iOS app, iOS Application Development Services, iPhone Application Development Company, Mobile Apps Development, Update
Healthy iOS Development Tips & Tricks

Healthy iOS Development Tips & Tricks

About iOS Development:

Being an iOS developer always feels exciting because it gives us a chance to work with & to do innovative things. There is always a scope for something new depends on developer capabilities & level of thinking.

But at the same time, it also has challenges in the application development like to compatible with latest iOS versions & at the same time should also work on lower versions as well. We also need to keep in mind about future iOS versions as well to make sure easy adaptability. In short, it should have always a scope for the future aspects.

Quick & Easy Tips that Should Help you

Design :

Use app thinning concept & create image sets into .xassets files only. Don’t directly put images into resource folder. Using .xassets applies app thinning & also allows image compression so it makes sure the archive file size will not get much affected by a large number of images.

App Icon / Launch screen & other graphical elements used in the application must not be size beyond 1 mb. Make sure all images are of few kb. Preferably 10-20 kb size of images makes app runs smoothly. If you find any image size of around 500 kb or more than 1 mb contact designer immediately & tell them to compress the image file & make it small size. There are lots of online tools available which allows compressing images without even designer help. Some of the good online tools are :



Right now 1 images are not getting used any more on iPhone devices. So there is no mean to add 1x images into .xassets folder. So you can keep it empty. That will reduce the number of images in the application so overall it will help to reduce the size of an application.

Keep removing unnecessary & unused images from an application. Sometimes it happens that large scale application has always keep updated with new graphics & adding/Removing features on the app. So at the time developer often forgets to remove old or unused images from the application. That files increases the application size & also downs the performance of the application as well. So it becomes necessary to keep cleaning unused files from the application.

Read more: Why does your Business need a Mobile App?


Always prefer to with ARC based on iOS Development. That will reduce the half of your work to reduce the memory usage

Keep removing unnecessary third-party libraries & classes that are not currently in use for the application. That will improve compilation time & improves app performance

Less Usage of nib files. That will always increase the memory load. Always prefer to add view controllers into a storyboard

Make sure storyboard does not load with too many controllers. That increases compile time of the application

Make View controller as light as possible as because too many controls added into view controller makes it slow in appearance. Make dynamic controls which are less in use. That will make view controller light in storyboard

“Simplicity is the best virtue”, That quote has always been a truth in iOS development. The more simplified code will less the complexity.

Use standard naming convention. It’s nothing but you need to keep in mind one thing that variable, methods or file whatever you create must be present their characteristics. For eg: you are taking string variable to store name then you should name it like “strName”

Use @autoreleasepool where arc doesn’t work or any major operations where you think causing the memory issues you can write that code inside @autoreleasepool. So what it will ensures that the relevant objects will be released just after the end of operation completion.

See example :

@autoreleasepool {
sourceTile.origin.y = y * sourceTileHeightMinusOverlap + sourceSeemOverlap;
destTile.origin.y = destResolution.height – (( y + 1 ) * sourceTileHeightMinusOverlap * imageScale + kDestSeemOverlap);
sourceTileImageRef = CGImageCreateWithImageInRect( sourceImageRef, sourceTile );
if( y == iterations – 1 && remainder ) {
float dify = destTile.size.height;
destTile.size.height = CGImageGetHeight( sourceTileImageRef ) * imageScale;
dify -= destTile.size.height;
destTile.origin.y += dify;
CGContextDrawImage( destContext, destTile, sourceTileImageRef );
CGImageRelease( sourceTileImageRef );

Find & resolve memory level warnings. Try to check the memory usage & CPU usage time by while navigating from one to another view controllers. That will give the rough idea about which view controller causing high memory usage so you can take appropriate actions on that page. For more detailed information like which line exactly causing memory leaks, you can use memory tools available with Xcode.

Use Pragma Symbols in a code to separate the functions.

Create classes & increase reusability of methods & functions. That will help to reduce compilation time by not to compile same functions again & again.

Remove Breakpoints, NSLogs once your purpose of it done. Also, remove commented & unused methods. That adds complexity to the project & increases development time.

Use dispatch_async function while performing UI operations through programming. This is a very common issue & makes application become unresponsive sometimes while performing UI operations & at the same time some another process blocks it. That results in bad user experience & user might leave the application in that case.

See example :

dispatch_async(dispatch_get_main_queue(), ^{
[self.collectionView reloadData];


By following above tips developer not only can develop & maintain high quality apps but also helps to make a seamless experience & make a user more active on the application. That helps to make application analytics stronger & it directly effects to improve app ranking on the store.

Tags: iOS, iOS app, iOS Application Development Services, iPhone Apps Development India, Mobile Apps Development, Mobility, New Feature
Why does your Business need a Mobile App?

Why does your Business need a Mobile App?

Every business is going digital. The majority of users access from their smart phones for searches. Not only big brands, but small and medium-sized businesses will need mobile app for an effective mobile strategy. Proficient mobile app brings added value in the user’s life.


Tags: Advertising, Business Apps, iOS Application Development Services, iPhone Application Development Company, iPhone Apps Development India, Mobile Apps Development, Mobility, Online Marketing, Small Business
How building an iPhone app can improve your Business?

How building an iPhone app can improve your Business?

iPhone has brought a revolution to the business domains. People spend most of the time on their devices so it has become very necessary to brand your business on iPhone through apps.

There are already more than 1.08 billion Smartphone users in the world, out of which, 91.4 million are from the United States. iPhone users spend an average of 1 hour and 15 minutes on their phones daily, as opposed to 49 minutes for Android users. And in 2014 it is projected people would start using their iPhone instead of their laptops. (more…)

Tags: Advertising, Business Apps, iOS Application Development Services, iPhone Application Development Company, iPhone Apps Development India, Mobile Apps Development, Mobility, Online Marketing, Small Business