![](/img/trans.png)
[英]UILocalNotification does not fire after 10 minutes in background
[英]Repeatedly fire an action every 10 minutes
我想在每10分钟使用一次应用程序后执行一次操作。
我想每10分钟显示一次全屏广告,而不管该应用程序的ViewController
当前在哪里。
您需要使用NSTimer
并设置timeInterval = 10
并repeats = YES
并将此计时器声明为didFinishLaunchingWithOptions
方法。 有关更多信息,您可以阅读NSTimer
官方文档。
还要看看我如何使用NSTimer?
尝试这个 :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
timer = [NSTimer scheduledTimerWithTimeInterval:600 target:self selector:@selector(doAction) userInfo:nil repeats:YES ];
[pool release];
}
希望它会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.