-
Notifications
You must be signed in to change notification settings - Fork 576
BackgroundAssets iOS xcode26.4 b2
Alex Soto edited this page Mar 20, 2026
·
2 revisions
#BackgroundAssets.framework https://github.com/dotnet/macios/pull/24940
diff -ruN /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManager.h /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManager.h
--- /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManager.h 2025-11-12 05:55:11
+++ /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManager.h 2026-02-16 07:19:20
@@ -12,8 +12,8 @@
/// A class that manages asset packs.
///
-/// The first time that your code refers to the shared manager, Background Assets considers that your app is opting into automatic system management of your asset packs.
-/// - Important: When using the asset-pack manager, make sure that you also adopt the corresponding managed extension protocol. For apps that use Apple hosting, the corresponding protocol is `SKDownloaderExtension` from StoreKit. For other apps, the corresponding protocol is ``BAManagedDownloaderExtension``. Not adopting the right protocol is a programmer error.
+/// The first time that your code refers to the shared manager, Background Assets considers that your application is opting into automatic system management of your asset packs.
+/// - Important: When using the asset-pack manager, make sure that you also adopt the corresponding managed extension protocol. For applications that use Apple hosting, the corresponding protocol is `SKDownloaderExtension` from StoreKit. For other applications, the corresponding protocol is ``BAManagedDownloaderExtension``. Not adopting the right protocol is a programmer error.
API_AVAILABLE(ios(26), macos(26), tvos(26), visionos(26))
API_UNAVAILABLE(watchos)
NS_REFINED_FOR_SWIFT
@@ -38,7 +38,7 @@
/// Gets the asset pack with the given identifier.
///
-/// If no asset pack with the given identifier is found, then the block will receive an `NSError` object with ``BAManagedErrorCode/BAManagedErrorCodeAssetPackNotFound`` as its code for the `error` parameter. This method might attempt to get the latest asset-pack information from the server.
+/// If no asset pack with the given identifier is found, then the block will receive an `NSError` object with ``BAManagedErrorCode/BAManagedErrorCodeAssetPackNotFound`` as its code for the `error` parameter. This method might attempt to get the latest asset-pack information from the server. To force the system to get the latest information from the server unconditionally, send ``checkForUpdatesWithCompletionHandler:`` to the shared asset-pack manager.
/// - Parameters:
/// - assetPackIdentifier: The asset packâs identifier.
/// - completionHandler: A block that receives the asset pack or an error if one occurs.
@@ -46,25 +46,68 @@
completionHandler:(void (^)(BAAssetPack* _Nullable assetPack, NSError* _Nullable error))completionHandler
NS_SWIFT_ASYNC_NAME(assetPack(withID:));
-/// Gets the status of the asset pack with the specified identifier.
+/// Gets an asset packâs status.
///
-/// If no asset pack with the specified identifier is found, then the block will receive an `NSError` object with ``BAManagedErrorCode/BAManagedErrorCodeAssetPackNotFound`` as its code for the `error` parameter. This method attempts to get the latest asset-pack information from the server. No updates or removals are automatically triggered.
+/// This method checks whether any version of the specified asset pack is currently downloaded. If one is, then it determines the version relationship between the downloaded asset pack and the specified asset pack. If they have different version numbers, then the status value that it passes to `completionHandler` will contain ``BAAssetPackStatus/BAAssetPackStatusOutOfDate``. The status value will contain ``BAAssetPackStatus/BAAssetPackStatusUpdateAvailable`` only if the relevant asset pack on the server hasnât been further updated since the initialization of the provided ``BAAssetPack`` instance.
+///
+/// For example, consider the following sequence of events, assuming that version 1 of the relevant asset pack is already available locally:
+/// 1. Your application calls ``getAssetPackWithIdentifier:completionHandler:`` to obtain a ``BAAssetPack`` instance.
+/// 2. The asset pack is updated to version 2 on the server.
+/// 3. Your application calls this method, passing the ``BAAssetPack`` instance from step 1.
+///
+/// In this case, the status value will indicate that the downloaded asset pack is up to date. Generally, you shouldnât need to handle this type of situation explicitly because the system automatically polls for updates periodically in the background.
+///
+/// This method doesnât automatically trigger any downloads, updates, or removals.
/// - Parameters:
+/// - assetPack: The asset pack.
+/// - completionHandler: A block that receives the asset packâs status or an error if one occurs.
+- (void)getStatusRelativeToAssetPack:(BAAssetPack*)assetPack
+ completionHandler:(void (^)(BAAssetPackStatus status, NSError* _Nullable error))completionHandler
+API_AVAILABLE(ios(26.4), macos(26.4), tvos(26.4), visionos(26.4));
+
+/// Gets an asset packâs local status.
+///
+/// This method checks only status values that are determinable offline. It doesnât induce any network traffic or automatically trigger any downloads, updates, or removals. The following status values are determinable offline:
+/// - ``BAAssetPackStatus/BAAssetPackStatusOutOfDate`` (in some situations)
+/// - ``BAAssetPackStatus/BAAssetPackStatusObsolete`` (in some situations)
+/// - ``BAAssetPackStatus/BAAssetPackStatusDownloaded``
+///
+/// Because this method doesnât communicate with the server, it canât determine whether a particular asset pack exists in the first place. Instead, it returns an empty status value when provided a nonexistent asset-pack ID, which is indistinguishable from the situation in which the asset pack does indeed exist but hasnât yet been downloaded. Use ``getStatusOfAssetPackWithIdentifier:completionHandler:`` to get a full view of an asset packâs status.
+/// - Parameters:
/// - assetPackIdentifier: The asset packâs identifier.
-/// - completionHandler: A block that receives the status of the asset pack or an error if one occurs.
-- (void)getStatusOfAssetPackWithIdentifier:(NSString*)assetPackIdentifier
- completionHandler:(void (^)(BAAssetPackStatus status, NSError* _Nullable error))completionHandler
-NS_SWIFT_ASYNC_NAME(status(ofAssetPackWithID:));
+/// - completionHandler: A block that receives the asset packâs local status.
+- (void)getLocalStatusOfAssetPackWithIdentifier:(NSString*)assetPackIdentifier
+ completionHandler:(void (^)(BAAssetPackStatus status))completionHandler
+API_AVAILABLE(ios(26.4), macos(26.4), tvos(26.4), visionos(26.4));
+/// Checks whether the asset pack with the specified identifier is available locally.
+/// - Parameter assetPackIdentifier: The asset packâs identifier.
+/// - Returns: Whether the asset pack is available locally.
+- (BOOL)assetPackIsAvailableLocallyWithIdentifier:(NSString*)assetPackIdentifier
+API_AVAILABLE(ios(26.4), macos(26.4), tvos(26.4), visionos(26.4))
+NS_SWIFT_NAME(assetPackIsAvailableLocally(withID:));
+
/// Ensures that the specified asset pack be available locally.
///
-/// This method checks if the asset pack is currently downloaded. If it isnât, then it schedules it to be downloaded and calls the block with `nil` for the blockâs `error` parameter when the download completes. Itâs guaranteed that the requested asset pack will be available locally once the block is called with `nil` for its `error` parameter. If a non-`nil` value is provided to the blockâs `error` parameter, then the asset pack is **not** guaranteed to be available locally. You can optionally monitor download progress by attaching a delegate object to `delegate`.
+/// This method checks if the asset pack is currently downloaded. If it isnât, then it schedules it to be downloaded and calls the block with `nil` for the blockâs `error` parameter when the download completes. Itâs guaranteed that the requested asset pack will be available locally once the block is called with `nil` for its `error` parameter. If a non-`nil` value is provided to the blockâs `error` parameter, then the asset pack is **not** guaranteed to be available locally. You can optionally monitor download progress by attaching a delegate object to ``delegate``.
/// - Parameters:
/// - assetPack: The asset pack the local availability of which to ensure.
/// - completionHandler: A block thatâs called when the asset pack is available locally or that receives an error if one occurs.
- (void)ensureLocalAvailabilityOfAssetPack:(BAAssetPack*)assetPack
completionHandler:(void (^)(NSError* _Nullable error))completionHandler;
+/// Ensures that the specified asset pack be available locally.
+///
+/// This method checks if the asset pack is currently downloaded. If it isnât, then it schedules it to be downloaded and calls the block with `nil` for the blockâs `error` parameter when the download completes. Itâs guaranteed that the requested asset pack will be available locally once the block is called with `nil` for its `error` parameter. If a non-`nil` value is provided to the blockâs `error` parameter, then the asset pack is **not** guaranteed to be available locally. You can optionally monitor download progress by attaching a delegate object to ``delegate``.
+/// - Parameters:
+/// - assetPack: The asset pack the local availability of which to ensure.
+/// - shouldUpdate: Whether to require that the latest version be available locally. When `YES` is passed to this parameter, the method will wait for the update (if there indeed is one available) to be downloaded before returning. When `NO` is passed, the method wonât check for updates and wonât attempt to download any.
+/// - completionHandler: A block thatâs called when the asset pack is available locally or that receives an error if one occurs.
+- (void)ensureLocalAvailabilityOfAssetPack:(BAAssetPack*)assetPack
+ requireLatestVersion:(BOOL)shouldUpdate
+ completionHandler:(void (^)(NSError* _Nullable error))completionHandler
+API_AVAILABLE(ios(26.4), macos(26.4), tvos(26.4), visionos(26.4));
+
/// Gets the latest asset-pack information from the server, updates outdated asset packs, and removes obsolete asset packs.
/// - Parameter completionHandler: A block that receives a set of identifiers of asset packs that are being updated and a set of identifiers of removed asset packs or an error if one occurs.
- (void)checkForUpdatesWithCompletionHandler:(nullable void (^)(NSSet<NSString*>* _Nullable updatingIdentifiers, NSSet<NSString*>* _Nullable removedIdentifiers, NSError* _Nullable error))completionHandler;
@@ -118,6 +161,18 @@
- (void)removeAssetPackWithIdentifier:(NSString*)assetPackIdentifier
completionHandler:(nullable void (^)(NSError* _Nullable error))completionHandler
NS_SWIFT_ASYNC_NAME(remove(assetPackWithID:));
+
+// MARK: Deprecated
+
+/// Gets an asset packâs status.
+///
+/// If no asset pack with the specified identifier is found, then the block will receive an `NSError` object with ``BAManagedErrorCode/BAManagedErrorCodeAssetPackNotFound`` as its code for the `error` parameter. This method attempts to get the latest asset-pack information from the server. It doesnât automatically trigger any downloads, updates, or removals.
+/// - Parameters:
+/// - assetPackIdentifier: The asset packâs identifier.
+/// - completionHandler: A block that receives the asset packâs status or an error if one occurs.
+- (void)getStatusOfAssetPackWithIdentifier:(NSString*)assetPackIdentifier
+ completionHandler:(void (^)(BAAssetPackStatus status, NSError* _Nullable error))completionHandler
+API_DEPRECATED_WITH_REPLACEMENT("-getStatusRelativeToAssetPack:completionHandler:", ios(26, 26.4), macos(26, 26.4), tvos(26, 26.4), visionos(26, 26.4));
@end
diff -ruN /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManifest.h /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManifest.h
--- /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManifest.h 2025-11-12 05:55:11
+++ /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackManifest.h 2026-02-16 11:07:15
@@ -49,7 +49,7 @@
///
/// The returned download objects can be scheduled with the download manager.
/// - Returns: A collection of download objects.
-/// - Remark: Use this method in your main app; use `-allDownloadsForContentRequest:` in your downloader extension.
+/// - Remark: Use this method in your main application; use ``allDownloadsForContentRequest:`` in your downloader extension.
- (NSSet<BADownload*>*)allDownloads;
/// Creates download objects for every asset pack in this manifest.
@@ -57,7 +57,7 @@
/// The returned download objects can be scheduled with the download manager.
/// - Parameter contentRequest: The content request for the current extension invocation.
/// - Returns: A collection of download objects.
-/// - Remark: Use this method in your downloader extension; use `-allDownloads` instead in your main app.
+/// - Remark: Use this method in your downloader extension; use ``allDownloads`` instead in your main application.
- (NSSet<BADownload*>*)allDownloadsForContentRequest:(BAContentRequest)contentRequest;
@end
diff -ruN /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackStatus.h /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackStatus.h
--- /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackStatus.h 2025-11-12 05:55:11
+++ /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAAssetPackStatus.h 2026-02-16 11:07:15
@@ -19,7 +19,7 @@
/// A status value that indicates that the downloaded asset pack is out of date.
///
- /// The presence of this status value doesnât necessarily imply that an update to the asset pack can be downloaded over the current network connection. Check for the presence of ``BAAssetPackStatus/updateAvailable`` to determine whether an update can currently be downloaded.
+ /// The presence of this status value doesnât necessarily imply that an update to the asset pack can be downloaded over the current network connection. Check for the presence of ``BAAssetPackStatus/BAAssetPackStatusUpdateAvailable`` to determine whether an update can currently be downloaded.
BAAssetPackStatusOutOfDate = 1 << 3,
/// A status value that indicates that the asset pack is no longer available to download.
diff -ruN /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAManagedDownloaderExtension.h /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAManagedDownloaderExtension.h
--- /Applications/Xcode_26.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAManagedDownloaderExtension.h 2025-11-12 05:55:10
+++ /Applications/Xcode_26.4.0-beta2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/BackgroundAssets.framework/Headers/BAManagedDownloaderExtension.h 2026-02-16 11:07:15
@@ -14,47 +14,45 @@
///
/// ## Creating an Objective-C Downloader Extension
/// Xcodeâs Background Download extension template generates Swift code when you select either the âApple-Hosted, Managedâ option or the âSelf-Hosted, Managedâ option, but you can easily switch to Objective-C instead if you prefer. To do so, follow these steps:
-/// 1. Remove `BackgroundDownloadHandler.swift`.
-/// 2. Create `DownloaderExtension.h` with the following contents:
-/// ### Apple Hosting
-/// ```objc
-/// #import <StoreKit/StoreKit.h>
+/// 1. Remove `BackgroundDownloadHandler.swift`.
+/// 2. Create `DownloaderExtension.h` with the following contents:
+/// ### Apple Hosting
+/// ```objc
+/// #import <StoreKit/StoreKit.h>
///
-/// \@interface DownloaderExtension : NSObject <SKDownloaderExtension>
+/// @interface DownloaderExtension : NSObject <SKDownloaderExtension>
///
-/// @end
-/// ```
+/// @end
+/// ```
///
-/// ### Self Hosting
-/// ```objc
-/// #import <BackgroundAssets/BackgroundAssets.h>
+/// ### Self Hosting
+/// ```objc
+/// #import <BackgroundAssets/BackgroundAssets.h>
///
-/// \@interface DownloaderExtension : NSObject <BAManagedDownloaderExtension>
+/// @interface DownloaderExtension : NSObject <BAManagedDownloaderExtension>
///
-/// @end
-/// ```
-///
-/// (Remove any backslash characters that may be rendered in the above code snippets.)
+/// @end
+/// ```
+/// 3. Create `DownloaderExtension.m` with the following contents:
+/// ```objc
+/// #import "DownloaderExtension.h"
///
-/// 3. Create `DownloaderExtension.m` with the following contents:
-/// ```objc
-/// #import "DownloaderExtension.h"
+/// @implementation DownloaderExtension
///
-/// @implementation DownloaderExtension
+/// - (BOOL)shouldDownloadAssetPack:(BAAssetPack *)assetPack {
+/// // Use this method to filter out asset packs that the system would otherwise download automatically. You can also remove this method entirely if you just want to rely on the default download behavior.
+/// return true;
+/// }
///
-/// - (BOOL)shouldDownloadAssetPack:(BAAssetPack *)assetPack {
-/// // Use this method to filter out asset packs that the system would otherwise download automatically. You can also remove this method entirely if you just want to rely on the default download behavior.
-/// return true;
-/// }
-///
-/// @end
-/// ```
-/// 4. Add `DownloaderExtension.m` to your extensionâs target.
-/// 5. Add the following snippet inside your extensionâs `Info.plist`âs `EXAppExtensionAttributes` dictionary:
-/// ```plist
-/// <key>EXPrincipalClass</key>
-/// <string>DownloaderExtension</string>
-/// ```
+/// @end
+/// ```
+/// 4. Add `DownloaderExtension.m` to your extensionâs target.
+/// 5. Add the following snippet inside your extensionâs `Info.plist`âs `EXAppExtensionAttributes` dictionary:
+/// ```plist
+/// <key>EXPrincipalClass</key>
+/// <string>DownloaderExtension</string>
+/// ```
+/// 6. Check that the downloader extensionâs target explicitly links the Background Assets framework under Frameworks and Libraries in the target editorâs General tab. If it doesnât, then click to add an item to the list. Select âBackgroundAssets.frameworkâ under Apple SDKs, then click Add.
API_AVAILABLE(ios(26), macos(26), tvos(26), visionos(26))
API_UNAVAILABLE(watchos)
NS_REFINED_FOR_SWIFT