Want to call a function after a particular interval,eventhough when app moved to back
Want to call a function after a particular interval,eventhough when app moved to background in iphone?
I tried with
-(IBAction)StartTimer{ NSTimer *timer = [[NSTimer
timerWithTimeInterval:10.0
target:self
selector:@selector(test)
userInfo:nil
repeats:NO
] retain];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
[timer release];
}
- (void)test
{
NSLog(@"test");
}
It is not working when app moved to back ground,When it is in foreground app terminates...How to resolve it?
I tried with perform selector,but I dont know how to add to loop.Is it possible to call a function in background...Help me....
|