[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil]; self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(btnClicked:) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];