1
我正在使用UILocalNotification
,但它没有按时发射,而是在指定时间后8-10分钟通知我。下面是我使用UILocalNotification没有在正确的时间被触发
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
[dateFormat setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
NSString *dateString = [dateFormat stringFromDate:[NSDate date]];
NSDate *notificationDate = [dateFormat dateFromString:dateString];
localNotif.fireDate = notificationDate;
localNotif.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
// Notification details
localNotif.alertBody = @"Appear";
// Set the action button
localNotif.alertAction = @"Action";
localNotif.soundName = UILocalNotificationDefaultSoundName;
// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
在didEnterRegion委托CLLocationManager
的代码,我用这个。我做错了什么?
这是工作的罚款。只需要用GeoFence测试:) – Hassy 2013-05-07 08:45:28
主要问题是时区。评论它做了魔术 – Hassy 2013-05-07 08:59:24