Método no llamado con dispatch_async y repitiendo NSTimer
Estoy desarrollando una aplicación donde quiero llamar al método en una cola separada usandodispatch_async
. Quiero llamar a ese método repetidamente después de cierto intervalo de tiempo. Pero el método no está siendo llamado.
No se lo que está mal. Aquí está mi código:
dispatch_async( NotificationQueue, ^{
NSLog(@"inside queue");
timer = [NSTimer scheduledTimerWithTimeInterval: 20.0
target: self
selector: @selector(gettingNotification)
userInfo: nil
repeats: YES];
dispatch_async( dispatch_get_main_queue(), ^{
// Add code here to update the UI/send notifications based on the
// results of the background processing
});
});
-(void)gettingNotification {
NSLog(@"calling method ");
}