iOS 5 Core Location
Jan 23rd
The following tutorial explains the use of Core Location Framework from iOS 5.
This application demonstrates use of
1) Core Location to track the location of the iphone
2) Map kit to visualize the location of the iphone
3) It places waypoints on the map after every 10 seconds and
4) Joins those waypoints using a black colored line.
Note : It is suggested to try out the application on the actual device as you cannot simulate location changes on the simulator
The Screenshots below explain how to
1) Create an xcode project using Xcode 4
2) Adding frameworks to the project (Mapkit and Core Location Framework)
3) Adding Delegates (MKMapViewDelegate, CLLocationManagerDelegate, UITextFieldDelegate)
4) Adding the basic UI elements using Interface builder
After this, i have included the header file which contains the properties and IBOutlets for the interface elements.
// iosViewController.h
// Tracker
// Created by Pratik Hande.
// Copyright (c) 2012. All rights reserved.
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
@interface iosViewController : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate, UITextFieldDelegate>{
// IBOutlets for the results of core location updates to be displayed
IBOutlet UITextField *latitudeLongitude;
IBOutlet UITextField *time;
IBOutlet UITextField *speed;
IBOutlet UITextField *distance;
// Core Location Manager for managing location updates
CLLocationManager *locationManager;
// Map View for displaying results to a map
IBOutlet MKMapView *map;
// An array of way points where pins would be dropped on the map
NSMutableArray *wayPoints;
// Timer elements for timing location updates
NSTimer *stopTimer;
NSDate *stopTime;
NSDate *startTime;
// Total distance form the starting location
float totalDistance;
// Location instances to save inetermediate locations
CLLocation *tempNewLocation, *tempOldLocation;
// To draw the connecting line between waypoints
MKPolyline * routeLine;
}
@property(nonatomic,retain) IBOutlet UITextField *latitudeLongitude;
@property(nonatomic,retain) IBOutlet UITextField *time;
@property(nonatomic,retain) IBOutlet UITextField *speed;
@property(nonatomic,retain) IBOutlet UITextField *distance;
@property(nonatomic, retain) CLLocationManager *locationManager;
@property(nonatomic, retain) IBOutlet MKMapView *map;
@property(nonatomic, retain) MKPolyline *routeLine;
@end
Implementation explained
In viewDidLoad()
1) We first create an instance of CLLocationManager and provide a delegate for it which is self. 2) We set the desiredAccuracy to 6.0 which indicates the accuracy desired on location horizontally.
3) We set the distanceFilter, which indicates the distance change after which a location update is received.
4) We call startUpdatingLocation method to start receiving location updates.
5) We assign a delegate for map view to self.
6) The setShowsUserLocation:YES shows a blue marker on the map view indicating the current location.
7) The call to setUserTrackingMode:MKUserTrackingModeFollow animated:YES allows the tracking of location on the map in an animated manner.
We also initialize an array for waypoints which would hold the locations on the map which have been marked.
9) Next we create, stop timer for based on a 10 second interval.
//
// iosViewController.m
// Tracker
//
// Created by Pratik Hande.
// Copyright (c) 2012. All rights reserved.
//
#import "iosViewController.h"
@implementation iosViewController
@synthesize latitudeLongitude, time, speed, distance, locationManager, map, routeLine;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = 6.0;
locationManager.distanceFilter = 6.0;
[locationManager startUpdatingLocation ];
map.delegate = self;
[map setShowsUserLocation:YES];
[map setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
wayPoints = [[NSMutableArray alloc] initWithCapacity:30];
totalDistance = 0.0;
stopTime = [NSDate dateWithTimeIntervalSinceNow:140];
startTime = [NSDate date];
SEL sel = @selector(timerTargetMethod);
NSInvocation* inv = [NSInvocation invocationWithMethodSignature:
[self methodSignatureForSelector:sel]];
[inv setTarget:self];
[inv setSelector:sel];
stopTimer = [NSTimer scheduledTimerWithTimeInterval:10 invocation:inv repeats:true];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
if(newLocation != nil && oldLocation != newLocation)
{
tempNewLocation = newLocation;
tempOldLocation = oldLocation;
}
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
}
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views
{
MKAnnotationView *annotationView = [views objectAtIndex:0];
id mp = [annotationView annotation];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate] ,250,250);
[mv setRegion:region animated:YES];
}
// MKMapViewDelegate
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id )overlay
{
MKOverlayView* overlayView = nil;
MKPolylineView * routeLineView = [[MKPolylineView alloc] initWithPolyline:self.routeLine];
routeLineView.fillColor = [UIColor colorWithRed:0.0-1.0 green:0.0-1.0 blue:0.0-1.0 alpha:1.0f];
routeLineView.strokeColor = [UIColor colorWithRed:0.0-1.0 green:0.0-1.0 blue:0.0-1.0 alpha:1.0f];
routeLineView.lineWidth = 10;
routeLineView.lineCap = kCGLineCapSquare;
overlayView = routeLineView;
return overlayView;
}
//define the targetmethod
-(void) timerTargetMethod
{
if([[NSDate date] timeIntervalSinceDate:startTime] >= 140)
{
[stopTimer invalidate];
[locationManager stopUpdatingLocation];
NSLog(@"Time started at %@", startTime);
NSLog(@"Time up at %@", stopTime);
}
else if (tempOldLocation.coordinate.latitude == tempNewLocation.coordinate.latitude && tempNewLocation.coordinate.longitude == tempOldLocation.coordinate.longitude)
{
NSLog(@" Fix location found ");
}
else if( [[NSDate date] timeIntervalSinceDate:startTime] >= 19 )
{
if(roundf([[NSDate date] timeIntervalSinceDate:startTime]) == 20)
{
NSLog(@"First Time Location Update");
latitudeLongitude.text = [[ NSString alloc] initWithFormat:@"%g , %g", tempNewLocation.coordinate.latitude, tempNewLocation.coordinate.longitude];
float interval = [[NSDate date] timeIntervalSinceDate:startTime];
int okInterval = roundf(interval);
NSLog(@"Interval 1 , %d", okInterval );
time.text = [[ NSString alloc] initWithFormat:@"%d", okInterval - 20];
speed.text = @"0";
totalDistance = 0;
distance.text = @"0 meters";
}
else
{
latitudeLongitude.text = [[ NSString alloc] initWithFormat:@"%g , %g", tempNewLocation.coordinate.latitude, tempNewLocation.coordinate.longitude];
float interval = [[NSDate date] timeIntervalSinceDate:startTime];
int okInterval = roundf(interval);
time.text = [[ NSString alloc] initWithFormat:@"%d", okInterval - 20];
NSLog(@"Interval 2 , %d , %f", okInterval , interval);
if((tempNewLocation.coordinate.latitude == tempOldLocation.coordinate.latitude && tempNewLocation.coordinate.longitude == tempOldLocation.coordinate.longitude) || tempNewLocation.speed = 0)
totalDistance += [tempNewLocation distanceFromLocation:tempOldLocation] - (tempNewLocation.horizontalAccuracy / 2);
else
totalDistance += [tempNewLocation distanceFromLocation:tempOldLocation];
if (totalDistance < 0)
distance.text = @"0 meters";
else
distance.text = [[ NSString alloc] initWithFormat:@"%g meters", totalDistance];
}
MKPointAnnotation *pa = [[MKPointAnnotation alloc] init];
pa.coordinate = tempNewLocation.coordinate;
[map addAnnotation:pa];
[wayPoints addObject:tempNewLocation];
MKMapPoint * pointsArray =
malloc(sizeof(CLLocationCoordinate2D)*2);
pointsArray[0]= MKMapPointForCoordinate(tempOldLocation.coordinate);
pointsArray[1]= MKMapPointForCoordinate(tempNewLocation.coordinate);
routeLine = [MKPolyline polylineWithPoints:pointsArray count:2];
free(pointsArray);
if (tempNewLocation.coordinate.latitude - tempOldLocation.coordinate.latitude < 1) {
[map addOverlay:routeLine];
}
}
}
@end
Here is the source code for the project. Tracker Source Code
Lua Programming Tutorial
Dec 21st
I have written a tutorial about Lua Programming Language. This tutorial is written for programmers who have prior experience with ‘C Like’ programming languages such as C, C++, Java or Objective-C.
I have tried to keep the description as minimal as possible and strived to make the sample code simple and self explanatory. This should get you up and running with Lua in record time. So you can learn to program mobile games for iPhone and Android with SDK’s like Corona and Moai.
You can find the tutorial here: Lua Programming Tutorial
Key points UI designers should know when designing for iPad
Dec 7th
Here are some points UI designers must keep in mind while developing UI for iPAD apps.
1. iPad’s screen size: 1024px x 768px
2. Status bar height: 20px
3. Screen Space available for the app when running in
| 1. | Portrait Mode: | 768px x 1004px |
| 2. | Landscape Mode: | 1024px x 748px |
4. iPad Screen PPI: 132
5. iPad Launch Image Names and Sizes
| Filename | Dimensions |
|---|---|
| Default-Portrait.png | 768px x 1004px |
| Default-Landscape.png | 1024px x 748px |
| Default-PortraitUpsideDown.png | 768px x 1004px |
| Default-LandscapeLeft.png | 1024px x 748px |
| Default-LandscapeRight.png | 1024px x 748px |
6. iPad app icon sizes
| Application icon (required for all apps) | 72px x 72px |
| App Store icon (required for all apps) | 512px x 512px |
| for Spotlight search results | 50px x 50px |
| for Settings | 29px x 29px |
| Toolbar and navigation bar icons | Approximately 20px x 20px |
| Tab bar icons | Approximately 30px x 30px |
7. Photoshop PSD and Vector Templates to get started with:
iPad vector GUI elements: tabs buttons menus icons
iPhone / iPad icon PSD template
8. Most important : It’s going to be used with touch (fingers not mouse pointer). Hence all UI elements must have at least 30px x 30px room so that they are comfortably touchable.
Also on touch devices, there is no “mouse over” effect.
9. Must read: iOS Human Interface Guidelines
Pricing Strategies for iOS / Android apps
Sep 30th
Mobisoft had a top paid app in a revenue-share model with client. App scaled to # 21 in lifestyle category. Naturally, we were excited to know the numbers – downloads, paid/free, adv hits etc. Although we made it great in terms of popularity, the earnings were less than expected.
The main reason was not having effective strategy for pricing model of app’s inApp & subscription purchases. What we realized is that “It could have been great to work on pricing strategy while developing the app” i.e. Monetization of app.
Why Monetize?
- Generate money
How?
- Compulsion Loops, there are ways to draw user back into the app
- Engagement, does it have engagement elements that could be monetized, i.e. virtual currency?
- Value, is it worth your users’ time?
Models
1. In-app purchases
2. Subscription
3. Ads
4. Location-based offerings
5. Social media sharing and aggregation
To do
1. Try various in-app models to find the combination that maximize your revenues
• Games: Subscription based casual gaming package + premium payment for sending best scores
• E-books for kids: read once for free. Pay to read again
• Security: free trial (e.g. 30 days) . Paid license for 1 year period
• Video: pay per gallery
2. Freemium strategy
- Strongest marketing play Risk reduction
- Developers should be focused on finding consumers who are willing to pay, not trying to completely satisfy free-rider consumers
In-App single purchase
Pros:
• This is probably the easiest path to implementation and launch and it’s straightforward and proven
• Virtual goods/currency through In-App
Cons:
• No ongoing revenue stream No access to user data – makes selling advertising difficult.
• One potential workaround is to build in-app surveys, which pushes data back.
Subscription – I
Pros:
- Revenue is sustainable
- Renew just as other web based subscriptions
- Easy extendable as an add-on
Cons:
- Requires user management solution
- Requires users to leave the app and visit the publisher’s website to subscribe
- Conversion rate lower than in-app purchases
- Success : lifetime value of a subscriber > revenue lost from lower conversion
Subscription – II
Apple’s subscription policy for publishers:
- Apple still gets a 30% cut of any subscription a reader signs up for inside the App Store.
- Publishers can now offer an app subscription for a different price than what they might sell their app for in the App Store.
- Publishers can’t link to an external-to-Apple location that sells a subscription within the app.
Advertising
Apple: iAd platform – Adv as an app
Third party : adMob, Medialets etc
Pros:
- Easier to command advertising premiums and less pressure to live up to metrics
Cons:
- Mobile budgets just aren’t well-defined
- Apple changes strategic decision with third party ad integration
Location Based Offerings
Pros:
- Awesome mobile offerings into a high-fidelity advertising environment
Cons:
- Complexity in integrating these systems
- Requires the device be connected to the internet
Social, Sharing & Aggregation
Pros:
- Cost-effective
- Viral marketing
- Better user engagement
Cons:
Getting advertiser support on a product as nebulous as this is challenging
Other payment integrations
- Paypal API integrations
- Carrier billing option – Very easy for users to pay
- Virtual credits
- Google Checkout
Other billing platforms
1 MoVend payment platform
- Easy integration – Supports Android, BlackBerry, Windows Phone7
- Sales Track Better user engagement
2 Bango
Supports all mobile platforms including Operator billing
Mobisoft Infotech recommend to work with clients as partners and provide various pricing strategies to monetize their app. It will be certainly helpful to clients to get pricing strategies correctly integrated while the app is being developed rather than working on monetization after app is live.
Thank you.
Key inputs to avoid Apple’s iOS app rejection
Apr 17th
An app idea or product app takes much of time and money investment to get into app world existence. The major hurdle to it’s success could be Apple’s review process. There can be numerous reasons for Apple’s rejections for your app. With our superior knowledge of iOS apps development since the day Apple launched their SDK, we are able to gain valuable insights into Apple’s review process.
This will help:
1. Developers to save their precious time and efforts.
2. Let you plan for a better user experience which is the key reason behind all the app store guidelines.
There are few key points which every iPhone/iPad developer should know when developing an app for Apple devices.
Key things to avoid Apple’s app rejection:
1. Bugs/Crashes- The most common reason for any app to get rejected are freezing and frequent crashes. Make sure you test it on multiple devices, different OS versions and specifically under varying network conditions. Peer-to-peer reviews/testing done by developers would certainly help. If your app crashes or doesn’t respond during the app review by Apple’s testing team then it will definitely be rejected.
2. Code Download- You cannot create an app that downloads and executes code that was not present in the app bundle submitted to Apple.
3. Similar Icons- The app store 512×512 icon should be same as the app’s 57×57 icon. Even though there is no such direct rule in contract/agreement with Apple, its their store and they make the rules for reviews. If your app’s icon on phone and app store icon do not match, Apple will state having un-matching icons to reject the app.
4. Network Connectivity- You must notify the user if network is unavailable. Just having the spinning busy icon display and a message saying “trying to connect” is against the guidelines. Proper message is needed at all the screens to convey clear message if network is not available after certain period of time. Many developers put their connectivity checks on Apple’s Reachability code, which is using that sample code for the wrong purpose. If you need to get data from a specific server, then try to download some data from that domain.
5. “Free+Paid” apps- Apple reported to few developers that app may get rejected, if it contains visually disabled buttons, prompting the user to upgrade for the full version or displaying the price of full version in the Free version. So, iPhone developers must ensure that they follow all the rules.
6. Consistent Button Images- If an iPhone developer wants to use Apple’s existing image for his button then see that functions are identical because you can use a standard button in a non-standard way if your app is providing a “immersive environment” so it is better to create your own button. If there are any variations with function then again Apple might reject the app.
It is always advisable for an iPhone developer to use their own custom buttons in the app
7. iOS version support- If you plan on submitting and app which runs with 3.0 and higher versions, you should be sure that it works perfectly on all the versions from the iOS 3.0 to the most current version. Apple will test it with the latest version to see the potential of the app but if the app fails to prove itself Apple will definitely rejected your app.
8. Transactions outside The App Store-
Apple do not allow developers to conduct any transaction/business outside the app store. In App purchases are the recommended way to implement these transaction. Recent announcement to allow outside payment transaction with certain restriction and Apple’s percentage take from money for the same is trickier and would take more time to settle down in business plan of apps sale.
9. Private API:s
Apple strictly reject apps which are implementing programs using Private APIs. Apple has scripts that can scan your app codes for violations. If you want to prevent app rejection from app store make sure you read the developer guidelines carefully before implementing any API marked private by Apple.
10. Popovers-
It is definitely not recommended to launch one popover from within another popover. The iPad Human Interface Guidelines clearly provides this information that only one popover element should be shown onscreen at a time.
There can be many more reasons behind Apple’s rejection of any iOS app. However, the list provides very obvious ones.
Mobisoft Infotech sincerely wish this post is helpful to all our developer community and prestigious clients to achieve great success with iOS apps launch.
If you have any suggestions/feedback, please send your inputs to info@mobisoftinfotech.com
& for business enquiries : business@mobisoftinfotech.com
Thank you
Mobisoft Infotech LLC along with Smarty-Ears empowering special kids with speech therapy iOS apps at Macworld 2011.
Jan 29th
Macworld Expo: San Francisco: Jan 27th, 2011.
With superior expertise in iPhone and iPad apps development, Mobisoft infotech LLC is delivering a family of apps for kids with special needs. In collaboration with Smarty Ears, Mobisoft Infotech provided services to develop apps for speech therapists. Apps which can improve child’s language and speech skills by helping children with communication difficulties.
Mobisoft infotech will be showcasing their most recent released apps for Smarty-Ears at the Macworld Expo 2011 in San Francisco. Macworld 2011. Newest app releases, “Articulate it!” is an application designed to help parents practice pronouncing sounds with their children
Articulation, language skills, and fluency are some of the areas in which we have developed apps in. Smarty-Ears is innovating Speech therapy with creative vision to enable therapists for improved practices and services. Mobisoft infotech with 110+ smartphone apps development experience, has been providing design and programming services for more than 5 app products on iPhone/iPad for speech therapists help.
Team achieved great accomplishments!!
Recognition from Apple users is evident when first app – “Sunny Articulation Test” was featured on Top #9 revenue generating app on iTunes. Apps we developed have been featuring on ‘What’s Hot’, ‘New & Noteworthy’ and ‘Top paid’ sections of Apple’s iTunes store.
‘Match2Say’ app was featured on “New and Noteworthy” on iTunes. At the same time on 11/07/2010 Match2Say was the top #5 Best selling education app.
Shailendra Sinhasane, Managing Director of this startup company founded it in early 2009 during his Computer Science Master’s program from University of Houston. Starting with application ‘MyIphonics’, they created educational apps with audio, object images and game playing integration. One of the first few apps developed by them ‘SocialFlyr’ for creating digital flyers to share across Facebook and Twitter social media was amazingly hit and topped to #20 paid lifestyle based app on iTunes store.
The company has been able to grow at astounding rate, from 3 people team to over 55 smartphone development consultants family. Mobisoft Infotech has great plans to
take a leap forward into ‘Web + Mobile + Social’ integrated solutions.
For more information about smartphone services visit: http://www.mobisoftinfotech.com
Or contact: business@mobisoftinfotech.com
References:
-
Macworld 2011 http://www.macworldexpo2011.com
-
MyIphonics app http://myiphonics.com/Home.html
-
Learn Alphabet Sounds With MyIphonics http://bit.ly/9P35Sz
-
Mobisoft Infotech iPhone technical share http://bit.ly/g1PCkf
-
New Company Combines Technological Advancements With Speech And Language Sciences. http://bit.ly/bK8vqH
-
Match2Say featured on iTunes http://bit.ly/bZM8l1
Android OS 2.3 (Gingerbread) is coming with NFC technology
Nov 23rd
Near field communication (NFC) is one of the latest technologies in mobile phones. This is nothing but a chip with short range high-frequency wireless communication technology that enables quick exchange of data between devices in the vicinity of about 10 cm distance. So you can virtually transfer data between two successive NFC enabled devices. NFC can be used for various purposes. Since it is capable of receiving and transmitting data at the same time, it can function as a smart contact-less card and it will definitely bring digital wallet concept in existence in near future.
At the Web 2.0 conference, Google CEO Eric Schmidt said Nexus S is the first android phone coming with android OS 2.3(Gingerbread) with capability of NFC technology. Apple is said to be working on the technology as well to incorporate it to the iPhone 5.
How NFC can be useful for mobile users?
1. NFC can be used for payment at kiosks, ticketing, Internet or person-to-person.
2. Tickets can be purchased, stored, and redeemed.
3. Prepaid card can be stored in smartphones
4. Coupons can be transferred to friends
5. Shopping list can be collected from bags
6. Electronic devices can be activated after purchase and warranties sent in. Or car keys, house/office keys, hotel room keys can get replaced by NFC enabled smartphones.
7. Secure access to buildings and PCs
8. Inventory control with tags and readers
9. Patient monitoring by keeping medical records on chip
10. Mobile users can touch the NFC enabled devices to exchange the information and contact details.
A person can lose credit card, wallet or personal documents but there are less chances to miss Mobiles and if it happen so, just inform mobile service provider and you can easily stop misuse of your identity, credit card, mobile & all personal information so called “Digital wallets” in one shot. User do not have to call 5 different customer service executive to stop credit card services.
By looking at above facts it looks NFC has promising potential in Mobile Future. Consider you check in at a shopping mall and you get to see the banners or campaign or offers with the your liking based on your behaviors of shopping. So it will be just a matter of booming your mobile devices anywhere(banners, photos, products etc) to get the information or perform transactions. Boom!!!
iPhone Local Notifications
Nov 22nd
Local notifications :
Local notifications are used to notify user that application is having some updates,
while application is not running in foreground. We can display an alert message or badge on application icon. Local notifications can play sound when alert message or badge is shown.
We can use local notification to remind our daily or monthly tasks at particular time like water plants, pay electricity bill, attend seminar , prepare for presentation etc. In these cases we can use local notification.
Create notification :
- (void)scheduleNotification { [[UIApplication sharedApplication] cancelAllLocalNotifications]; UILocalNotification notif = [[cls alloc] init]; notif.fireDate = [datePicker date]; notif.timeZone = [NSTimeZone defaultTimeZone]; notif.alertBody = @"Reminder for you"; notif.alertAction = @"Show"; notif.soundName = UILocalNotificationDefaultSoundName; notif.applicationIconBadgeNumber = 1; NSDictionary *userDict = [NSDictionary dictionaryWithObject:@"Notification text" forKey:kRemindMeNotificationDataKey]; notif.userInfo = userDict; [[UIApplication sharedApplication] scheduleLocalNotification:notif]; [notif release];
}
Cancel any exiting local notification
[[UIApplication sharedApplication] cancelAllLocalNotifications];
Allocate and initialize UILocalNotification object
UILocalNotification *notif = [[cls alloc] init];
Set fire date and timezone. Fire date is date and time when system should deliver the notification. Date is calculated depending on timezone specified.If we do not specify timezone then it will take GMT as default time zone.
notif.fireDate = [datePicker date]; notif.timeZone = [NSTimeZone defaultTimeZone];
We can control alert message displayed when notification is delivered by setting alertBody and alert action by setting alertAction.
notif.alertBody = @"Reminder for you"; notif.alertAction = @"Show";
We can also specify sound to be played when notification is delivered by setting soundName and also specify badge number on application icon by setting applicationIconBadgeNumber.
notif.soundName = UILocalNotificationDefaultSoundName; notif.applicationIconBadgeNumber = 1;
We can also pass custom data with notification by adding it into dictionary. We can add dictionary to notification using userInfo property.
NSDictionary *userDict = [NSDictionary dictionaryWithObject:@"Notification text" forKey:kRemindMeNotificationDataKey]; notif.userInfo = userDict;
Here we are passing notification text as custom data.
In case if we want to increase icon badge number we can get current badge number by using.
[[UIApplication sharedApplication] applicationIconBadgeNumber ];
If you want to repeat notification then you can set following property to required calendar unit.
notif.repeatInterval = NSMinuteCalendarUnit; OR notif.repeatInterval = NSHourCalendarUnit; OR notif.repeatInterval = NSDayCalendarUnit; OR notif.repeatInterval = NSWeekCalendarUnit;