performSelector:withObject:afterDelay: not making call

前端 未结 4 1969
情书的邮戳
情书的邮戳 2021-02-19 00:45

in a method, i want to call a method after n seconds:

    self.toolBarState = [NSNumber numberWithInt:1];
    [self changeButtonNames];
    [self drawMap];
    [         


        
4条回答
  •  [愿得一人]
    2021-02-19 01:31

    Does your class still exist in memory?

    If your class goes away before the performSelector fires, do you wind up sending the message to nil (which would cause nothing to occur). You could test this by dropping an NSLog into your dealloc()

    You mentioned threads. If your performSelector isn't called from the MainThread it could cause issues (UI things should be done on the main thread).

提交回复
热议问题