I want to fire an action after every 10 minutes of application use.
I want to display a full screen advertisement after every 10 minutes, irrespective of where ViewController
of the application is currently at.
I want to fire an action after every 10 minutes of application use.
I want to display a full screen advertisement after every 10 minutes, irrespective of where ViewController
of the application is currently at.
You need to use NSTimer
with set the timeInterval = 10
and repeats = YES
and declare this timer to your didFinishLaunchingWithOptions
method. For more information you can read this official documentation of NSTimer
.
And also look at How do I use NSTimer?
Try this :
- (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];
}
Hope it will help.