gpt4 book ai didi

objective-c - NSGregorianCalendar 已弃用

转载 作者:行者123 更新时间:2023-12-02 05:58:01 25 4
gpt4 key购买 nike

我有一个问题。我想知道如何删除 Warning ?谢谢`

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

最佳答案

如果您阅读错误消息(使 View 更宽),您将看到 NSGregorianCalendar 自 iOS 8 以来已被替换为 NSCalendarIdentifierGregorian

所以使用NSCalendarIdentifierGregorian

关于objective-c - NSGregorianCalendar 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41183873/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com