Friday, 6 September 2013

NSTimer in a autoreleasepool so that it can run in background without effect other Thread


- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    NSThreadpoolTimer = [[NSThread alloc]initWithTarget:self selector:@selector(loopCall) object:nil];
    [poolTimer start];
}

-(void)loopCall
{
    @autoreleasepool
{
        NSRunLoop *timer = [NSRunLoop currentRunLoop];
        [NSTimer scheduledTimerWithTimeInterval:1   target:self selector:@selector(yourMethodForRepeat) userInfo:nil repeats:YES];
        [TimerRunLoop run];
    }

}