background-thread

How to always run a service in the background?

邮差的信 提交于 2019-11-26 05:59:21
问题 I am in the process of creating an app that is similar to the built-in SMS app. What I need: a service that is always running in the background every 5 min. the service checks the current location of the device and calls a web service if certain criteria are met, the service should generate a notification (just like the SMS app) when the notification is clicked, the user is taken to the app (just like the SMS app) when the app is installed the service should be started when the device is

Proper use of beginBackgroundTaskWithExpirationHandler

梦想与她 提交于 2019-11-26 03:28:57
问题 I\'m a bit confused about how and when to use beginBackgroundTaskWithExpirationHandler . Apple shows in their examples to use it in applicationDidEnterBackground delegate, to get more time to complete some important task, usually a network transaction. When looking on my app, it seems like most of my network stuff is important, and when one is started I would like to complete it if the user pressed the home button. So is it accepted/good practice to wrap every network transaction (and I\'m

Getting a “This application is modifying the autolayout engine from a background thread” error?

十年热恋 提交于 2019-11-25 23:33:33
问题 Been encountering this error a lot in my OS X using swift: \"This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.\" I have a my NSWindow and I\'m swapping in views to the contentView of the window. I get the error when I try and do a NSApp.beginSheet on the window, or when I add a subview to the window. Tried disabling autoresize stuff, and I don\'t have anything