我在这里做错了什么?我错过了什么?Custom RunLoop模式
- (void)scheduleTimer
{
NSTimer *timer = [NSTimer timerWithTimeInterval:0.15
target:self
selector:@selector(wtf:)
userInfo:nil
repeats:NO];
// This works fine
// [[NSRunLoop currentRunLoop] addTimer:timer
// forMode:NSDefaultRunLoopMode];
// This doesn't work at all - how come?
[[NSRunLoop currentRunLoop] addTimer:timer
forMode:@"MyCustomRunLoopMode"];
}
- (void)wtf:(NSTimer *)aTimer
{
NSLog(@"wtf");
}
NSRunLoop的文档似乎表明可以创建自定义runloop模式。我错过了什么吗?
(这是在Mac OS X标准的GUI应用程序的主线程)
更新:我提到这个通知是一个标准的应用程序的主线程上。因此,我没有自己运行runloop。这一切都由NSApplication处理。