过期
来源:互联网 发布:英文手写字体知乎 编辑:程序博客网 时间:2024/04/27 20:31
-(BOOL)checkClientAvailable{
BOOL success = YES;
NSDictionary *deviceAuthoDic = [NSDictionarydictionaryWithContentsOfFile:[CataloggetAuthoFilePath]];
if (deviceAuthoDic) {
NSInteger clientRenewType = [[deviceAuthoDicobjectForKey:@"clientRenewType"]integerValue];
if (clientRenewType == 1) {
success = YES;
}
else{
NSDate *nowDate = [NSDatedate];
NSTimeInterval beginDate = [[deviceAuthoDicobjectForKey:@"beginDate"]doubleValue];
if ( beginDate > [nowDate timeIntervalSince1970]){ //在可使用期内
NSTimeInterval endDate = [[deviceAuthoDicobjectForKey:@"endDate"] doubleValue];
if ([nowDate timeIntervalSince1970] > endDate) {
NSTimeInterval endDateExtend = [[deviceAuthoDicobjectForKey:@"endDateExtend"] doubleValue];
NSTimeInterval time = [[NSDatedateWithTimeIntervalSince1970:endDateExtend] timeIntervalSinceDate:nowDate];
NSInteger day = time/86400;
NSString *message = [NSStringstringWithFormat:@"证书还有%d天过期",day];
UIAlertView *alertView = [[UIAlertViewalloc] initWithTitle:@"提示"message:message delegate:selfcancelButtonTitle:@"确定"otherButtonTitles: nil];
[alertView show];
[alertView release];
if ([nowDate timeIntervalSince1970] > endDateExtend) {
UIAlertView *alertView = [[UIAlertViewalloc] initWithTitle:@"方正慧云单机版已过期" message:@"请更新新版本"delegate:self cancelButtonTitle:@"确定"otherButtonTitles: nil];
[alertView show];
[alertView release];
success = NO;
}
}
}
else{
NSString *useTime = [NSStringstringWithFormat:@"客户端在%@之后才可使用",[NSDatedateWithTimeIntervalSince1970:beginDate]];
UIAlertView *alert = [[UIAlertViewalloc]initWithTitle:@"提示"message:useTime delegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil,nil];
[alert show];
[alert release];
}
}
}
return success;
}
//是否过期
- (BOOL)isOutOfDate
{
return NO;
NSDate *now = [NSDatedate];
NSDateComponents *component = [[NSDateComponentsalloc] init];
[component setDay:1];
[component setMonth:5];
[component setYear:2013];
NSCalendar *gregorian = [[NSCalendaralloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *theDay = [gregorian dateFromComponents:component];
if ([now compare:theDay] ==NSOrderedAscending) {
return NO;
}
[component release];
[gregorian release];
return YES;
}
- 过期
- RegisterStartupScript 过期
- Session过期
- 过期文章
- 过期日志
- session 过期
- websphere过期
- WebSphere过期
- SecureCRT 过期
- 数据库过期
- Session过期
- sourcetree过期
- SQLyog过期
- session 过期?
- 网页过期、网页过期的解决办法
- myeclipse过期以后提示过期以后怎么办?!
- redis过期时间的过期策略
- Session过期问题
- iOS使用DES加解密
- 今天开博。
- Java设置与读取Cookie属性 央邦0首付,低押金先就业后付款
- JS计算从某一日期到现在的时间差
- 网页栅格系统研究(3):粒度问题
- 过期
- highcharts点击事件获取点击点的值
- 对称加密 非对称加密 不可逆加密算法
- 开源 免费 java CMS - FreeCMS-数据对象-comment
- RSA 加密与加签
- 设计一门脚本语言——(四)简单表达式的处理
- log4j使用方法
- java的volatile与多线程
- [电脑技巧]如何创建类似于“我的文档”一样的系统文件夹: