耶!!

你总是这样轻言放弃的话,无论过多久都会在原地踏步

每天10点来一条通知(待考证)

UILocalNotification*notification = [[UILocalNotification alloc] init];
    NSDate *date = [NSDate date];
    NSTimeZone*gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
    NSCalendar*gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
    [gregorian setTimeZone:gmt];
    NSDateComponents*components = [gregorian components:NSUIntegerMax fromDate:date];
    [components setHour:10-8];
    [components setMinute:30];
    [components setSecond:0];
    NSDate*newDate = [gregorian dateFromComponents:components];
    notification.fireDate = newDate;
    notification.repeatInterval = kCFCalendarUnitDay;
    notification.applicationIconBadgeNumber = 0;
    notification.alertBody = @"正在定时自动更新资源";
    notification.alertAction = @"打开应用";
    notification.alertLaunchImage = @"Default";
    notification.soundName = UILocalNotificationDefaultSoundName;
    [[UIApplication sharedApplication]scheduleLocalNotification:notification];

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jianandjan/article/details/49965467
个人分类: 代码片
上一篇UIView,UIButton,UIImageView等设置圆角,设置阴影,设置边框的方法
下一篇iOS 获取UIWebView上面的按钮点击事件
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭