Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

past notification appears

$
0
0

I want to create an app that has to notify four times a day, ie: (9.am,12.pm,5.pm,9.pm). It should have different notifications in every time for 365 days. The problem is if I create a notification on 2014-03-10 09:00 it works, but if I already created a notification on 2014-03-09 all four notifications appear when run it. I need help fixing it

' NSDateFormatter *df = [[NSDateFormatter alloc] init];

[df setDateFormat:@"yyyy-MM-dd HH:mm"];

NSDate *myDate = [df dateFromString:@"2014-03-10 01:04"];

 NSDate *myDate1 = [df dateFromString:@"2014-03-10 01:21"];

NSDate *myDate2 = [df dateFromString:@"2014-03-10 01:22"];

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

n1.fireDate = myDate;

n1.alertBody = @"one";

[[UIApplication sharedApplication] scheduleLocalNotification: n1];

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

n2.fireDate = myDate1;

n2.alertBody = @"uuu";

[[UIApplication sharedApplication] scheduleLocalNotification: n2];

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

n3.fireDate = myDate2;

n3.alertBody = @"ontt";

[[UIApplication sharedApplication] scheduleLocalNotification: n3];'

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>