我使用 NSThread 在单独的线程上创建一个对象。
NSThread* myThread = [[[NSThread alloc] initWithTarget:self selector:@selector(createNewObject:) object:elements] autorelease];
[myThread start]; // Actually start the thread
该对象等待一个事件。当该事件发生时,会在默认通知中心发布通知。
我的 AppController 观察到该通知并运行一个选择器。
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(myMethod:) name:MyNotification object:nil];
问题:选择器中的方法(myMethod:)是在主线程上运行还是在上面的线程(myThread)上运行?