Skip to content

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

@Jerryshen170918

Description

@Jerryshen170918

[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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions