So basically, I have this timer that should be repeated when it receives a key event, and invalidates when the user releases the key. However, I am unable to "validate" the timer back even by calling the addTimer:forMode:
in NSRunLoop. Does anyone know why this is happening and how I can fix this? Thanks.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
- Converting (u)int64_t to NSNumbers
Once you've invalidated an NSTimer, you shouldn't use it again.
Instead, create a new timer instance, and use that instance to add to the NSRunLoop's addTimer method. Personally I prefer just calling NSTimer's scheduledTimerWithTimeInterval because it does everything in one shot.
From NSTimer docs:
You cannot use invalidated timer.
From Apple Docs: