A third-party library provides a function I need to call every 100ms. Setting up a timer to do that works very well as long as my app is on foreground. When my app is on background timer works for a while but after a about a minute timer is called only after 10 second delay. The same happened when I created a separate thread with usleep-function. Is there any way I can keep timer running while my app is on background?
OS X Cocoa timer not fired when application on background
1.9k Views Asked by superg At
2
There are 2 best solutions below
Related Questions in MACOS
- How do I customize NSOutlineView to have border color?
- Force sublime text to use PATH from the shell value
- Do executable files always open a terminal window on MacOS?
- setting OpenGL version in objective-C
- C std library don't appear to be linked in object file
- Cross compile simple standard C program on Linux for Mac
- How to generate request format for WCF web service method for Mac and iPhone
- Bundle Multiple Xamarin apps in one pkg installer
- How to Handle Command Line Prompt from a Cocoa App
- AVFoundation - Process each image separately
- CMYK NSImage get pixel data
- how i get the mac of ibeacon or BLE
- Set JAVA_HOME on Mac
- Finding active IPv6 interfaces under Mac OS (using Python)
- OSX: Why is my launchd agent running my script twice?
Related Questions in NSTIMER
- NSTimer won't start (Swift)
- NSTimer start and call method every 2 seconds and stop after 3 minutes
- Using NSTimer is Swift causes 'deinit' not to call
- Spawning a Spritekit node at a random time
- Adding time to NSTimer
- UIView transitionWithView not working first time only
- NSTimer firing more than it should
- Swift / Xcode6: How to change when the UIButton functionality is called after clicking the button
- How to create an alarm clock app with swift?
- How do I run a function with a parameter every 5 seconds in Swift?
- Countdown with several decimal slots, using NSTimer in Swift
- iOS Objective-C: Strange BOOL behaviour
- NSTimer questions (closure, @objc, and etc.)
- NSTimer behavior in background (addTimer:, beginBackgroundTaskWithExpirationHandler:)
- performSelector is calling new in if loop
Related Questions in SLEEP
- Delphi and sleep function
- Clear labels, Images in WatchKit after didDeactivate (Glance and InterfaceController)
- Php schedule run a function after 10 minutes
- How to change the delay of sleep/timer thread in android during runtime?
- Compile error on linux (a simple demo code on concept of pipe)
- Timeout handle email php
- Running delayed jobs in loop
- Explain behavior of Unix sleep() function executed on Android
- Sleep Shiny WebApp to let it refresh... Any alternative?
- Will process lost wake-up chance in a preemptive kernel?
- Does sleep/nanosleep work by utilizing a busy wait scheme?
- Python time.sleep on line 2 happens before line 1
- VBS - How to pause a script until a key is pressed?
- How to keep track of time in python without sleeping?
- Sleeping the time difference
Related Questions in NSTHREAD
- NSThread detachNewThreadSelector: Crash only in release build in Xcode 7 + Swift 2.0
- how to use block in [nsthread detachNewThreadSelector]
- UIActivityIndicatorView stop animating after minimize app and resume app?
- autorefreshing uiviewcontroller in ios 5.1
- Thread still running of old view
- Data between NSThread
- Perform a connected-check every n seconds on iOS
- Sprite animation not working in NSThread method in Cocos2d
- OS X Cocoa timer not fired when application on background
- setKeepAliveTimeout and BackgroundTasks
- NSTimer memory manage question
- Speed up NSThread message passing
- (iphone) which one is more precise timewise: performSelector:afterDelay vs NSTimer
- How to implement NSThread to constantly perform the function in background in iPhone SDK
- NSTimer never starts
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Use beginActivityWithOptions:reason: to disable app nap for your application.