我注意到我主线程中的以下平庸调用
[self performSelectorOnMainThread:@selector(rollBar:) withObject:nil waitUntilDone:false];
导致[NSThread isMultiThreaded]
报告我的应用程序
已成为多线程.我认为只有
当你分离一个线程时才会发生这种情况,
在一个线程内排队消息的东西不应该这样做.
任何见解?
这个问题不一样,这一个.
停止按下
我的错,rollBar:
叫[m_progress_bar incrementBy: 0.5];
.
漂亮,可舔,动画NSProgressIndicator
是负责
使我的应用程序成为多线程.这是令人惊讶的.
我不知道.
令人惊讶的是,[m_progress_bar usesThreadedAnimation]
总是
返回NO
,即使我的应用程序挂起时条形图也会动画.
你确定吗?我将以下代码放在appDelegate的init方法中:
NSLog(@"Multi-threaded before? %@", [NSThread isMultiThreaded] ? @"Yes" : @"No");
[self performSelectorOnMainThread: @selector(setDelegate:) withObject: self waitUntilDone: NO];
NSLog(@"Multi-threaded after? %@", [NSThread isMultiThreaded] ? @"Yes" : @"No");
2008-10-21 07:26:28.296 MyApplication[82963:20b] Multi-threaded before? No 2008-10-21 07:26:28.297 MyApplication[82963:20b] Multi-threaded after? No
我还在
我的applicationWillTerminate:方法中添加了第二个语句,它也告诉我它不是多线程的.
NSLog(@"Multi-threaded before? %@", [NSThread isMultiThreaded] ? @"Yes" : @"No");
[self performSelectorOnMainThread: @selector(setDelegate:) withObject: self waitUntilDone: NO];
NSLog(@"Multi-threaded after? %@", [NSThread isMultiThreaded] ? @"Yes" : @"No");