метод не вызывается с dispatch_async и повторяется NSTimer
Я занимаюсь разработкой приложения, в котором я хочу вызывать метод в отдельной очереди, используяdispatch_async
, Я хочу вызывать этот метод несколько раз после определенного интервала времени. Но метод не вызывается.
Я нене знаю, что не так. Вот мой код:
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 ");
}