NSTimer Not Stopping When Invalidated

后端 未结 7 1299
情书的邮戳
情书的邮戳 2021-01-05 05:22

I have the following code in my .h file:

#import 
#import 
#import 

        
7条回答
  •  不知归路
    2021-01-05 06:04

    If the code at the end (starting with if) is called twice with UserType != Owner, you create a new timer without invalidating the old one. Now two timers are running. If the code executes a third time, you will add a third timer and so on. Executing the code with UserType == Owner only invalidates the last timer and even it is called repeatly, it does not invalidate older timers.

    You have a timer leak. ;-)

提交回复
热议问题