How to maintain Timer to continue running when Home button is pressed
<p>I have done research how to maintain the timer running when home button is pressed.  But i am quite confused.</p>

<p>This is my code, how can i fix it and the timer continue running in background? Thanks in advance.</p>

<pre><code>-(id)init {

if (self = [super init]) {
    self.timer = [[NSTimer alloc] init];
    self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(startTimer) userInfo:nil repeats:YES];
}
return self;
}

+(Timer *)sharedSingleton {

static Timer *sharedSingleton = nil;
static dispatch_once_t onceToken;
dispatch_once(&amp;onceToken, ^{
    sharedSingleton = [[Timer alloc] init];
});
return sharedSingleton;
}

-(void)startTimer {


i++;
_count = [NSNumber numberWithInteger:i];
[[NSNotificationCenter defaultCenter] postNotificationName:COUNT object:_count];
}
</code></pre>