摘要:
IOS 多线程 有三种主要方法(1)NSThread(2)NSOperation(3)GCD下面简单介绍这三个方法1.NSThread 调用方法如下: 如函数需要输入参数,可从object传进去。 (1) [NSThread detachNewThreadSelector:@selector(threadInMainMethod:) toTarget:self withObject:nil]; (2) NSThread* myThread = [[NSThread alloc] initWithTarget:self selector:@selector(threadInMain... 阅读全文
摘要:
解决方法如下dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSTimer* t = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(Reconnect:) userInfo:nil repeats:NO]; [[NSRunLoop currentRunLoop] addTimer:t forMode:NSDefaultRunLoopMode]; [[NSRun... 阅读全文