Hi readers,
My app has a daily reminder feature, but it only works for the first time but it's not repeating please have a glance at my code which is written below.
In Appdelegate:
UIUserNotificationSettings *uns = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound) categories:nil];
[[UIApplication sharedApplication] registerForRemoteNotifications];
[[UIApplication sharedApplication] registerUserNotificationSettings:uns];
In ViewController:
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setYear:2017];
[comps setMonth:01];
[comps setDay:01];
[comps setHour:16];
[comps setMinute:05];
[comps setSecond:0];
[comps setTimeZone:[NSTimeZone localTimeZone]];
NSCalendar *cal = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *setTime = [cal dateFromComponents:comps];
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = setTime;
localNotification.alertBody = @"It’s time to practise your speech sounds for the day";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.repeatInterval = NSCalendarUnitDay;
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.applicationIconBadgeNumber =1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];//Rajai
Guys Please help me out with this,I don't even know where I'm stuck.