An easy way to fix this is adding your NSTimer
to the mainRunLoop
.
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
To remove a timer from all run loop modes on which it is installed, send an invalidate
message to the timer.
More Related Contents:
- UIScrollView pauses NSTimer until scrolling finishes
- How to use UIScrollView in Storyboard
- Passing parameters to a method called by NSTimer in Swift
- NSTimer not fired when uiscrollview event occurs
- Setting up UIScrollView to swipe between 3 view controllers
- iphone sdl Invalid conversion between vector type '__m64'
- Provisioning profile doesn’t include the application-identifier and keychain-access-groups entitlements
- Swift 4 “This class is not key value coding compliant”
- ViewDidAppear is not called when opening app from background
- How to use generic protocol as a variable type
- SecItemAdd always returns error -34018 in Xcode 8 in iOS 10 simulator
- Xcode quits unexpectedly every time I open my project
- Xcode 9 Swift Language Version (SWIFT_VERSION)
- Dynamic Height Issue for UITableView Cells (Swift)
- ios 8 – buttons in horizontal scroll view intercepting pan event – scroll does not work
- Auto layout UIScrollView with subviews with dynamic heights
- Crashlytics in iOS won’t proceed past “Build Your Project” in Fabric app
- Is there a way to test my Xcode 7.2-compiled app with iOS 9.3?
- How can I change height of Navigation Bar – Swift 3
- LaunchScreen.xib not displaying my custom font
- Swift ios check if remote push notifications are enabled in ios9 and ios10
- Xcode 11 backward compatibility: “UIWindowScene is only available in iOS 13 or newer”
- “Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.” when using GCC
- When do app sources need to be included in test targets?
- Estimated app’s store size
- Are view controllers with nib files broken in ios 8 beta 5?
- What does get-task-allow do in Xcode?
- Invalid Device State – Xcode/iOS Simulator error
- How to pass data from child to parent view controller? in swift
- Swift compatibility between versions for a library