내 앱의 만료일을 설정해야합니다. 에 대한 응용 프로그램이 열리고 코드 지금이내 앱의 만료 날짜를 1 개월로 설정하십시오.
NSError *error;
NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"ExpiredDate" inManagedObjectContext:context];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc]init];
[fetchRequest setEntity:entityDesc];
NSArray *fetchedObjects = [[context executeFetchRequest:fetchRequest error:&error] retain];
[fetchRequest release];
if([fetchedObjects count ]<=0)
{
NSDate *todays=[[NSDate alloc]init];
NSDateFormatter *date=[[NSDateFormatter alloc]init];
[date setDateFormat:@"MM/DD/YYYY"];
[date stringFromDate:todays];
NSString *datelabel = [NSString stringWithFormat:@"%@",
[date stringFromDate:todays]];
NSManagedObject *objUser;
NSError *error;
objUser = [NSEntityDescription insertNewObjectForEntityForName:@"ExpiredDate" inManagedObjectContext:context];
[objUser setValue:datelabel forKey:@"date"];
if (![context save:&error])
{
NSLog(@"Problem saving: %@", [error localizedDescription]);
}
}
else
{
for(int i=0; i< [fetchedObjects count]; i++)
{
edate = [fetchedObjects objectAtIndex:i];
}
NSLog(@"%@",edate.date);
if(onemonth)
{
alertview:if one month completed then i have to show a pop up.please upgrade }
else
{
my code should execute
}
}
처럼 갈 때 현재 은, 난 그냥 날짜를 계산하려면, 날짜를 저장하고 (내가 저장 한있는 내가 문자열처럼 저장하고있다) 현재 날짜가 1 개월이고 월이 지난 경우 업그레이드를하시기 바랍니다.
스토어 날짜 즉 현재 날짜 + 30. 그리고 앱이 시작될 때마다 현재 날짜와 저장된 날짜를 비교합니다. 현재 날짜가 더 크면 팝업이 표시됩니다. – Iducool
@ 어 맨 정말요? 너 정말 놀랍다. – trojanfoe
한 가지 작업을 수행 할 수도 있습니다. 그것에 대한 로컬 알림을 추가하십시오. – Iducool