「Objective-Cの入門」iOSで NSDate日付を操作するサンプルプログラム

Objective-Cコード下記:
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];
}

NSTimeInterval interval =24*60*60*1; //1 日数

IOS

Posted by arkgame