-
Notifications
You must be signed in to change notification settings - Fork 569
BackgroundTasks macOS xcode27.0 b1
Alex Soto edited this page Jun 9, 2026
·
1 revision
#BackgroundTasks.framework
diff -ruN /Applications/Xcode_26.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTask.h /Applications/Xcode_27.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTask.h
--- /Applications/Xcode_26.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTask.h 2026-04-18 21:35:41
+++ /Applications/Xcode_27.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTask.h 2026-06-02 00:28:11
@@ -13,7 +13,7 @@
/// An abstract class representing a task that’s run while the app is in the
/// background.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGTask : NSObject
/// The string identifier of the task.
@@ -82,7 +82,7 @@
/// Processing tasks run only when the device is idle. The system terminates any
/// background processing tasks running when the user starts using the device.
/// Background refresh tasks are not affected.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGProcessingTask : BGTask
@end
@@ -94,7 +94,7 @@
/// Health research tasks may only be used by applications entitled to perform
/// studies and user's have opted in to the relevant study. These apps must have the
/// `com.apple.developer.backgroundtasks.healthresearch` entitlement.
-BG_EXTERN API_AVAILABLE(ios(17.0), tvos(32.0)) API_UNAVAILABLE(macos, tvos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(17.0), watchos(26.0)) API_UNAVAILABLE(macos, tvos)
@interface BGHealthResearchTask : BGProcessingTask
@end
@@ -111,7 +111,7 @@
/// <doc://com.apple.documentation/documentation/bundleresources/information_property_list/uibackgroundmodes>
/// capability. For information on setting this capability, see
/// ``BGTaskScheduler``.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGAppRefreshTask : BGTask
@end
@@ -124,7 +124,7 @@
/// ``BGContinuedProcessingTask``s _must_ report progress via the ``NSProgressReporting`` protocol conformance during
/// runtime and are subject to expiration based on changing system conditions and user input. Tasks that appear stalled
/// may be forcibly expired by the scheduler to preserve system resources.
-BG_EXTERN API_AVAILABLE(ios(26.0)) API_UNAVAILABLE(macos, tvos, visionos, watchos, macCatalyst)
+BG_EXTERN API_AVAILABLE(ios(26.0), watchos(27.0)) API_UNAVAILABLE(macos, tvos, visionos, macCatalyst)
@interface BGContinuedProcessingTask : BGTask<NSProgressReporting>
/// The localized title displayed to the user.
diff -ruN /Applications/Xcode_26.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskRequest.h /Applications/Xcode_27.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskRequest.h
--- /Applications/Xcode_26.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskRequest.h 2026-04-18 22:15:42
+++ /Applications/Xcode_27.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskRequest.h 2026-06-02 00:30:55
@@ -12,7 +12,7 @@
/// An abstract class that represents a request for the app to be launched in the background to perform work.
/// Do not instantiate instances of this class directly. Instead, use one of its concrete subclasses.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGTaskRequest : NSObject <NSCopying>
/// The identifier of the task associated with the request.
@@ -38,7 +38,7 @@
/// Schedule a refresh task request to ask that the system launch your app briefly so that you can download data and
/// keep your app's contents up-to-date. The system will fulfill this request intelligently based on system conditions
/// and app usage.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGAppRefreshTaskRequest : BGTaskRequest
/// Return a new refresh task request for the specified identifier.
@@ -57,7 +57,7 @@
/// life to handle deferrable, longer-running processing, such as syncing, database maintenance, or similar tasks. The
/// system will attempt to fulfill this request to the best of its ability within the next two days as long as the user
/// has used your app within the past week.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGProcessingTaskRequest : BGTaskRequest
/// Return a new processing task request for the specified identifier.
@@ -90,7 +90,7 @@
/// A request to launch your app in the background to execute a health research task for studies a user has opted into
/// and that can take minutes to complete.
-BG_EXTERN API_AVAILABLE(ios(17.0), tvos(17.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(17.0), tvos(17.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGHealthResearchTaskRequest : BGProcessingTaskRequest
/// A String indicating file protection availability required for processing.
@@ -111,7 +111,7 @@
/// substantial load and is unable to immediately run the task. Queued ``BGContinuedProcessingTaskRequest``s will be
/// cancelled when the user removes your app from the app switcher.
BGContinuedProcessingTaskRequestSubmissionStrategyQueue
-} NS_SWIFT_NAME(BGContinuedProcessingTaskRequest.SubmissionStrategy) API_AVAILABLE(ios(26.0)) API_UNAVAILABLE(macos, tvos, visionos, watchos, macCatalyst);
+} NS_SWIFT_NAME(BGContinuedProcessingTaskRequest.SubmissionStrategy) API_AVAILABLE(ios(26.0), watchos(27.0)) API_UNAVAILABLE(macos, tvos, visionos, macCatalyst);
typedef NS_OPTIONS(NSInteger, BGContinuedProcessingTaskRequestResources) {
/// No special system resources required.
@@ -127,13 +127,13 @@
///
/// - Important: Applications must have the `com.apple.developer.background-tasks.continued-processing.gpu` entitlement to submit a task request with this resource.
BGContinuedProcessingTaskRequestResourcesGPU NS_SWIFT_NAME(gpu) = (1 << 0),
-} NS_SWIFT_NAME(BGContinuedProcessingTaskRequest.Resources) API_AVAILABLE(ios(26.0)) API_UNAVAILABLE(macos, tvos, visionos, watchos, macCatalyst);
+} NS_SWIFT_NAME(BGContinuedProcessingTaskRequest.Resources) API_AVAILABLE(ios(26.0), watchos(27.0)) API_UNAVAILABLE(macos, tvos, visionos, macCatalyst);
#pragma mark -
/// A request to begin a workload immediately, or shortly after submission, which is allowed to continue running even if
/// the app is backgrounded.
-BG_EXTERN API_AVAILABLE(ios(26.0)) API_UNAVAILABLE(macos, tvos, visionos, watchos, macCatalyst)
+BG_EXTERN API_AVAILABLE(ios(26.0), watchos(27.0)) API_UNAVAILABLE(macos, tvos, visionos, macCatalyst)
@interface BGContinuedProcessingTaskRequest : BGTaskRequest
/// The localized title displayed to the user.
diff -ruN /Applications/Xcode_26.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskScheduler.h /Applications/Xcode_27.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskScheduler.h
--- /Applications/Xcode_26.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskScheduler.h 2026-04-18 21:20:16
+++ /Applications/Xcode_27.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/BackgroundTasks.framework/Headers/BGTaskScheduler.h 2026-05-24 00:13:59
@@ -17,7 +17,7 @@
NS_ASSUME_NONNULL_BEGIN
/// The background tasks error domain as a string.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
NSErrorDomain const BGTaskSchedulerErrorDomain;
/// An enumeration of the task scheduling errors.
@@ -53,14 +53,14 @@
/// submitting a ``BGContinuedProcessingTaskRequest``. Task requests that are successfully ran will not be
/// associated with any error code.
BGTaskSchedulerErrorCodeImmediateRunIneligible = 4,
-} API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos);
+} API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos);
/// A class for scheduling task requests that launch your app in the background.
///
/// Background tasks give your app a way to run code while the app is suspended.
/// To learn how to register, schedule, and run a background task, see
/// <doc://com.apple.documentation/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/using_background_tasks_to_update_your_app>.
-BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(macos) API_UNAVAILABLE(watchos)
+BG_EXTERN API_AVAILABLE(ios(13.0), tvos(13.0), watchos(26.0)) API_UNAVAILABLE(macos)
@interface BGTaskScheduler : NSObject
- (instancetype)init NS_UNAVAILABLE; //Use the shared scheduler object instead
+ (instancetype)new NS_UNAVAILABLE; //Use the shared scheduler object instead
@@ -94,7 +94,7 @@
/// Submit a previously registered background task for execution.
///
-/// Submitting a task request for an unexecuted task that’s already in the queue replaces the previous task request.
+/// Submitting a task request for an unexecuted task that's already in the queue replaces the previous task request.
///
/// There can be a total of 1 refresh task and 10 processing tasks scheduled at any time. Trying to schedule more tasks
/// returns ``BGTaskSchedulerErrorCode/BGTaskSchedulerErrorCodeTooManyPendingTaskRequests``.
@@ -104,7 +104,44 @@
/// - error: If an error occurs, upon return contains an error object that indicates why the request was rejected
/// - Returns: `YES` if the request was successfully submitted; `NO` if there was an error
- (BOOL)submitTaskRequest:(BGTaskRequest *)taskRequest
- error:(NSError * _Nullable *)error;
+ error:(NSError * _Nullable *)error
+ API_DEPRECATED("Use submitTaskRequest:completionHandler: instead to capture all error conditions",
+ ios(13.0, 27.0), tvos(13.0, 27.0), watchos(26.0, 27.0))
+ API_UNAVAILABLE(macos);
+
+/// Submits a background task request to be scheduled with a completion handler.
+///
+/// This method asynchronously submits the task request and invokes the completion
+/// handler with any errors that occur during submission.
+///
+/// Submitting a task request for an unexecuted task that's already in the queue replaces the previous task request.
+///
+/// There can be a total of 1 refresh task and 10 processing tasks scheduled at any time. Trying to schedule more tasks
+/// will result in an error with code ``BGTaskSchedulerErrorCode/BGTaskSchedulerErrorCodeTooManyPendingTaskRequests``.
+///
+/// - Parameters:
+/// - taskRequest: The task request object representing the parameters of the background task to be scheduled.
+/// - completionHandler: A block that is called when submission completes. The block receives an optional error parameter:
+/// - `nil` if the task was submitted successfully
+/// - An `NSError` if submission failed
+///
+/// Common errors include:
+/// - ``BGTaskSchedulerErrorCode/BGTaskSchedulerErrorCodeNotPermitted``: Task identifier not permitted or unsupported resources requested
+/// - ``BGTaskSchedulerErrorCode/BGTaskSchedulerErrorCodeTooManyPendingTaskRequests``: Too many pending tasks of this type
+/// - ``BGTaskSchedulerErrorCode/BGTaskSchedulerErrorCodeUnavailable``: Background refresh disabled or app not permitted
+/// - ``BGTaskSchedulerErrorCode/BGTaskSchedulerErrorCodeImmediateRunIneligible``: Immediate run not eligible due to system conditions
+///
+/// The completion handler is called on an arbitrary queue.
+///
+/// - Note: The completion handler may be invoked on a arbitrary queue after an arbitrary amount of delay.
+/// Do not call this method from the main thread or performance-critical contexts.
+///
+/// This method replaces the deprecated ``submitTaskRequest:error:`` method
+- (void)submitTaskRequest:(BGTaskRequest *)taskRequest
+ completionHandler:(void (^)(NSError * _Nullable error))completionHandler
+ NS_SWIFT_ASYNC_NAME(submitTaskRequest(_:))
+ API_AVAILABLE(ios(27.0), tvos(27.0), watchos(27.0))
+ API_UNAVAILABLE(macos);
/// Cancel a previously scheduled task request.
///