iOS-Interview-Questions icon indicating copy to clipboard operation
iOS-Interview-Questions copied to clipboard

# 8.PerformSelector:afterDelay:这个方法在子线程中是否起作用?

Open Jerryshen170918 opened this issue 5 years ago • 0 comments

[NSRunLoop.currentRunLoop run];开启runloop后可以用了

- (void)viewDidLoad {
    [super viewDidLoad];
    queue = dispatch_queue_create("asds", DISPATCH_QUEUE_CONCURRENT);
    dispatch_async(queue, ^{
        [self performSelector:@selector(testSel:) withObject:@"asdfd" afterDelay:3];
        [NSRunLoop.currentRunLoop run];
    });
}
- (void)testSel:(id)sender{
    NSLog(@"%s=%@",__FUNCTION__,sender);
}

Jerryshen170918 avatar Dec 20 '19 05:12 Jerryshen170918