时间加减比较

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

 NSDate *update = [[NSUserDefaults standardUserDefaults] objectForKey:APP_UPDATE_TIME];
                    CGFloat dayDifference;
                    if (update) {
                        dayDifference = [[NSDate date] timeIntervalSinceDate:update]/ 60.0/60.0/24.0;
                    }
                    if (!update || dayDifference > 2) {
                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"更新提示V%@",systemVersionNo] message:config[@"releaseNotes"] delegate:self cancelButtonTitle:@"稍后升级" otherButtonTitles:@"立即更新", nil];
                        [alert show];
                    }