NSGregorianCalendar deprecated

3.4k views Asked by At

I have a problem. I wanted to know how to remove Warning ? thanks `

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];

}`warnig photo

1

There are 1 answers

0
rckoenes On BEST ANSWER

If you read the error message (make the view wider) you will see that NSGregorianCalendar is now replaced with NSCalendarIdentifierGregorian since iOS 8.

So use NSCalendarIdentifierGregorian