【发布时间】:2013-11-28 13:15:48
【问题描述】:
我正在开发一个应用程序,我想使用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 ");
}
【问题讨论】:
标签: ios iphone grand-central-dispatch nstimer