In my iPhone app,from one of the views I want to print NSLog(@"Refreshed"); in all 1 minute interval. How can I do that?
Use NSTimer
like bellow:-
Define NSTimer in your .h class
NSTimer *TimeOfActiveUser;
in .m
- (void)viewWillAppear:(BOOL)animated
{
TimeOfActiveUser = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(actionTimer) userInfo:nil repeats:YES];
}
-(void)actionTimer
{
//Print your log
}
IF YOU WISH TO STOP NSTIMER..? SET ANOTHER ACTION LIKE
-(void)stopTimer
{
[TimeOfActiveUser invalidate];
TimeOfActiveUser = nil;
}
Hope its help's you my Friend.. happy coding :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With