我用下面的代码为本地通知本地通知问题
for (int i=0;i<newBirthDates.count;i++)
{
NSDate *date =[Formatter1 dateFromString:[newBirthDates objectAtIndex:i ]];
NSComparisonResult result = [date compare:todaydate];
if(result == NSOrderedSame)
{
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = date;
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"birthdate notification";
localNotif.alertAction = @"View";
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
}
}
newBirthdate is array with dates in it
Formatter1 =MM/dd.
让说在newbrithdate日期之一是18/3所以我要做的就是我
日期更改我的电脑和17/3 11时59分,然后我等待1分钟,它变成18/3,但我没有得到任何通知 时间在我的模拟器总是与我的电脑时间相同。
您是否尝试首先打印日期? – nsgulliver 2013-03-18 11:13:03
是的日期是在该数组中的MM/dd合成 – user1660882 2013-03-18 11:14:33
如果你知道你的timeZone,那么为什么不设置你自己的时区,看它是否有效? – nsgulliver 2013-03-18 11:18:31