metoda nie wywołana z dispatch_async i powtarzająca NSTimer
Zajmuję się tworzeniem aplikacji, w której chcę wywołać metodę w osobnej kolejce za pomocądispatch_async
. Chcę wywoływać tę metodę wielokrotnie po określonym czasie. Ale metoda nie jest wywoływana.
Nie wiem co jest źle. Oto mój kod:
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 ");
}