I am developing a MAC OS X application with SWIFT and ObjC using XCode 6.1. The application is a server and it uses a CFSocketRef in the main thread run loop.
When the application window has not the focus on it the application slows down and the server receives the messages from the client with delay.
Is this normal (an app with no focus slows down)? If it is normal is there a way to set the main thread priority so that if the app has no focus it continues running in the same way?
In my controller class I have added in the awakeFromNib function the beginActivityWithOptions and than in the applicationWillTerminate the endActivity like the following
class ConsoleController: NSObject
{
var process : NSProcessInfo?
var activity: NSObjectProtocol?
override func awakeFromNib()
{
process = NSProcessInfo.processInfo()
activity = process!.beginActivityWithOptions(NSActivityOptions.UserInitiated, reason: "Good")
}
func applicationWillTerminate(notification: NSNotification)
{
process!.endActivity(activity!)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With