NSGregorianCalendar已弃用

2 xcode objective-c nscalendar

我有个问题.我想知道如何删除警告?谢谢

NSDate *fireDate = [picker_date date];

NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
[offsetComponents setMinute:-10];
NSDate *heure_notification = [gregorian dateByAddingComponents:offsetComponents toDate:fireDate options:0];


UILocalNotification *local_rappel_notification = [[UILocalNotification alloc]init];
local_rappel_notification.fireDate = heure_notification;
local_rappel_notification.alertBody = @"VOUS AVEZ  UN VOL MAINTENANT DANS 10 MIN!!";
local_rappel_notification.timeZone = [NSTimeZone defaultTimeZone];
local_rappel_notification.soundName = UILocalNotificationDefaultSoundName;
local_rappel_notification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;

[[UIApplication sharedApplication ]scheduleLocalNotification:local_rappel_notification];
Run Code Online (Sandbox Code Playgroud)

}`warnig照片

rck*_*nes 11

如果您阅读错误消息(使视图更宽),您将看到NSGregorianCalendar现在已经替换为NSCalendarIdentifierGregorianiOS 8.

所以使用 NSCalendarIdentifierGregorian