How to Create UILocalNotification, repeating every minute ?

There are two types of notifications in iOS, One is Local notification & other is PUsh notification. Added code to create Local notification.

// creating notification
NSDate *newDate = [NSDate dateWithTimeIntervalSinceNow:60];

// where 60 = seconds, so add your seconds here
Class cls = NSClassFromString(@”UILocalNotification”);
if (cls != nil) {
UILocalNotification *notification = [[cls alloc] init];
notification.fireDate = newDate;
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.alertBody = @“My Notification”;
notification.alertAction = @”Show me”;
notification.soundName = UILocalNotificationDefaultSoundName;
notification.applicationIconBadgeNumber = 1;
notification.repeatInterval = NSMinuteCalendarUnit;
NSString *str = @“String to pass”;
NSDictionary *userDict = [NSDictionary dictionaryWithObject:str forKey:@“myNotification”];
notification.userInfo = userDict;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
[notification release];
}

// receiving notification
– (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
NSLog(@”Notification: %@”, [notification.userInfo objectForKey:@“myNotification”]);
}


Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at info@nanostuffs.com, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box