사용하는 무기 호
같은 객체를 설정합니다. 그런 다음 응용 프로그램이 시작될 때마다 (또는 더 자주) 현재와 현재 시간의 차이가 7 일인지 확인합니다.
const NSString *kFirstLaunchDateKey = @"firstLaunchDate";
NSDate *firstLaunchDate = [[NSUserDefaults standardUserDefaults] objectForKey:kFirstLaunchDateKey];
// If this is the first time the app has been launched we record right now as the first time the app was launched.
if (!firstLaunchDate) {
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:kFirstLaunchDateKey];
return;
}
NSTimeInterval *diff = abs([firstLaunchDate timeIntervalSinceNow]);
if (diff > 60 * 60 * 24 * 7) {
// Seven days have passed since the app was first launched.
// Display the rate button.
}
는 매개 변수로 응용 프로그램의 번들 식별자로
- (void)removePersistentDomainForName:(NSString *)domainName
를 호출하는 경우.
From Apple’s documentation:
domainName
그 키와 값이 당신이 원하는 도메인. 이 값은 응용 프로그램의 번들 식별자와 같아야합니다.