现在的位置: 首页 > 综合 > 正文

给app加上时间限制

2017年11月30日 ⁄ 综合 ⁄ 共 619字 ⁄ 字号 评论关闭
 NSDate *  senddate=[NSDate date];
    NSCalendar  * cal=[NSCalendar  currentCalendar];
    NSUInteger  unitFlags=NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit;
    NSDateComponents * conponent= [cal components:unitFlags fromDate:senddate];
    NSInteger year=[conponent year];
    NSInteger month=[conponent month];
    NSInteger day=[conponent day];
    int dayNum = year*10000+month*100+day;
    if(dayNum>20130222&&dayNum<20130310)
    {
    
     if(g_sqlite==nil)
     {
        g_sqlite = [[CSqlite alloc]init];
        [g_sqlite openSqlite];
     }
    }
    else{
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"您当前使用的是测试版本,已过测试期限,请联系开发商" delegate:self cancelButtonTitle:@"确定" otherButtonTitles: nil];
        [alert show];
    }

抱歉!评论已关闭.