如果这是不可能的,那么在使用应用程序 3 分钟后我该怎么做?这将用于给我们评分警报,但我希望用户在要求他们评分之前有一些时间实际使用该应用程序。
问问题
1235 次
4 回答
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;
}
于 2012-06-18T04:40:31.247 回答
1
于 2012-06-18T05:27:34.523 回答
0
您需要为NSTimer
要显示警报的时间间隔设置一个。当应用程序启动时启动计时器并在您设置的时间间隔结束后显示警报。
于 2012-06-18T04:41:06.163 回答
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;
}
于 2012-06-18T05:28:08.040 回答