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