を使用して別のキューでメソッドを呼び出したいアプリを開発しています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 ");
}