如果那是不可能的,那么在使用3分钟之后我该怎么办?这将用于Rate Us警报,但我希望用户有一些时间来实际使用该应用程序,然后才能要求他们评分。
答案 0 :(得分:6)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)options {
// ...
if ([self plusPlusLaunchCount] == 2) {
[self showRateUsAlert];
}
return YES;
}
- (void)showRateUsAlert {
// show the Rate Us alert view
}
- (NSInteger)plusPlusLaunchCount {
static NSString *Key = @"launchCount";
NSInteger count = 1 + [[NSUserDefaults standardUserDefaults] integerForKey:Key];
[[NSUserDefaults standardUserDefaults] setInteger:count forKey:Key];
return count;
}
答案 1 :(得分:1)
答案 2 :(得分:0)
您需要为要显示提醒的时间间隔设置NSTimer
。当应用程序启动时启动计时器,并在设置完成后的时间间隔内显示警报。
答案 3 :(得分:0)
我建议您使用每次启动应用程序时调用的DidBecomeActive,并且来自后台/睡眠模式:
如果用户长时间不使用应用程序,您需要取消计时器。
- (void)applicationDidBecomeActive:(UIApplication *)application{
// Override point for customization after application launch.
rateUsTimer = [[NSTimer scheduledTimerWithTimeInterval:180
target:self
selector:@selector(showRateUsAlert)
userInfo:nil
repeats:NO] retain];
}
- (void)applicationWillResignActive:(UIApplication *)application{
[rateUsTimer_ invalidate];
[rateUsTimer_ release];
rateUsTimer = nil;
}
- (void)applicationDidEnterBackground:(UIApplication *)application{
[rateUsTimer_ invalidate];
[rateUsTimer_ release];
rateUsTimer = nil;
}
- (void)showRateUsAlert {
//Here you present alert
[rateUsTimer_ release];
rateUsTimer = nil;
}