所以我有一个服务 clint 类,它有一个名为 fetch 的方法。我正在使用 NSInvocationOperation 调用此方法。当我检查线程时,它似乎正在调用主线程上的方法。使用 NSInvocationOperation 异步运行的重点不是吗?
调用方法
ServiceClient *client = [[ServiceClient alloc] init];
NSInvocationOperation *invocatopnOperation = [[NSInvocationOperation alloc] initWithTarget:client selector:@selector(fetch) object:nil];
[invocatopnOperation start];
服务客户端中的方法
- (void)fetch
{
if ([[NSThread currentThread] isEqual:[NSThread mainThread]])
{
NSLog(@"NOOOOOO");
}
............
}