UIWebView in multithread ViewController

前端 未结 8 814
日久生厌
日久生厌 2020-12-24 09:38

I have a UIWebView in a viewcontroller, which has two methods as below. The question is if I pop out(tap back on navigation bar) this controller before the second thread is

相关标签:
8条回答
  • 2020-12-24 10:20
    - (void)dealloc
    {
        if(![NSThread isMainThread]) {
            [self performSelectorOnMainThread:@selector(dealloc) 
                                   withObject:nil 
                                waitUntilDone:[NSThread isMainThread]];
            return;
        } 
        [super dealloc];
    }
    
    0 讨论(0)
  • 2020-12-24 10:24

    I tried :

    [self retain];
    [self performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:NO];
    

    which seems to work even better.

    0 讨论(0)
提交回复
热议问题