Methode nicht mit dispatch_async aufgerufen und NSTimer wiederholt

Ich entwickle eine App, bei der ich die Methode in einer separaten Warteschlange mit aufrufen möchtedispatch_async. Ich möchte diese Methode nach einem bestimmten Zeitintervall wiederholt aufrufen. Aber die Methode wird nicht aufgerufen.

Ich weiss nicht, was falsch ist. Hier ist mein Code:

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 ");
}

Antworten auf die Frage(3)

Ihre Antwort auf die Frage