Tuesday, September 8, 2015 [Tweets] [Favorites]

NSBackgroundActivityScheduler

Milen Dzhumerov:

If your Mac app needs to run background tasks in an energy efficient way, use NSBackgroundActivityScheduler (10.10+)

This class was introduced at WWDC 2014, but it’s not documented in the release notes or in the Foundation class reference. It is, however, explained in the Energy Efficiency Guide for Mac Apps, and there’s a header file with some good comments:

This class provides a Cocoa-level interface to the XPC Activity API (see xpc/activity.h).

It is used to schedule maintenance or background kinds of tasks. These activities are run by the OS at a time that best accommodates system-wide factors like energy, thermal conditions, and CPU usage. If you have activities that run at an interval measured in 10s of minutes or more, then use this class to schedule those activities.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment