What's New / App Services, Foundation & Diagnostics

What's new in AppManagedFeatures

+12 NewiOS

AppManagedFeatures is an app extension point for feature activation. Its API declares activation configurations, applies restrictions, and gates activation on software update requirements, coordinated through a FeatureManager actor that manages ActivationExtension instances.

The 27 SDK adds 12 APIs and deprecates or removes none. New types are the ActivationExtension and ActivationExtensionConfiguration protocols, the FeatureManager actor, the Restrictions and SoftwareUpdateRequirement structs, and the AppManagedFeaturesError enum with its RawValue. This is a new framework, not a revision of existing API.

New

12
protocol

ActivationExtension

NewiOS
public protocol ActivationExtension : AppExtension, Sendable

An object that implements the activation protocol for 3rd party extensions. This protocol is API and should be implemented by the 3rd party activation extension.

Declaration
public protocol ActivationExtension : AppExtension, Sendable {

    func willActivate(serialNumber: String, imei: String, organizationID: String) async throws

    func didDeactivate() async

    func checkIn() async
}
extension

ActivationExtension

NewiOS
extension ActivationExtension

Extends the ActivationExtension protocol by providing a configuration object for the extension. This configuration object provides the glue from the internal XPC protocol to the 3rd party provided functions.

Declaration
extension ActivationExtension {

    /// The configuration object for the extension.
    @MainActor public var configuration: some ActivationExtensionConfiguration { get }
}
protocol

ActivationExtensionConfiguration

NewiOS
public protocol ActivationExtensionConfiguration : AppExtensionConfiguration

An object that is the configuration object for the activation extension.

Declaration
@MainActor @preconcurrency public protocol ActivationExtensionConfiguration : AppExtensionConfiguration {
}
enum

AppManagedFeaturesError

NewiOS
public enum AppManagedFeaturesError : Int, Error, Codable

Error definitions for the App Managed Features framework

Declaration
public enum AppManagedFeaturesError : Int, Error, Codable {

    /// The connection to an activation function was interrupted after the connection was started
    case activationExtensionInterrupted

    /// The managing application failed to install during activation
    case applicationInstallFailed

    /// Background task scheduling failed during testing
    case backgroundTaskSchedulingFailed

    /// Failed excluding configuration file from backup
    case backupExclusionFailed

    /// Bundle identifier was not found in the configuration or system
    case bundleIDNotFound

    /// An app managed features configuration already exists on the device
    case configurationAlreadyExists

    /// An empty string was found in the input array for lock()
    case emptyStringParameter

    /// Extension call returned error
    case extensionReturnedError

    /// Unable to allocate the software update client
    case failedToCreateSoftwareUpdateClient

    /// A feature is disabled by a feature flag being off
    case failedToInstallProviderApp

    /// The managing app could not be marked as removable on deactivate
    case failedToMarkAppRemovable

    /// Unable to retrieve metadata for the managing application during activation
    case fetchingApplicationMetadataFailed

    /// Invalid background task identifier provided
    case invalidBackgroundTaskIdentifier

    /// The app managed features configuration is invalid
    case invalidManagementProviderConfiguration

    /// The software update DDM payload is invalid
    case invalidSoftwareUpdatePayload

    /// AppManagedFeatures framework is not supported on this platform
    case macCatalystUnsupported

    /// An appropriate extension cannot be located on the system and is likely not installed or not registered correctly
    case noActivationExtensionInstalled

    /// The operation requires developer mode to be active, but it is not
    case notInDeveloperMode

    /// The device is not enrolled in app managed features
    case noManagementProviderConfiguration

    /// The device does not have archived configuration
    case archivedConfigurationNotFound

    /// Setting or removing the device restrictions failed
    case restrictionsFailed

    /// App Managed Features framework is not supported on visionOS platform
    case visionOSUnsupported

    /// Unknown error
    case unknownError

    /// Retrieval of the cloud configuration from teslad was unsuccessful
    case unsuccessfulCloudConfigurationRetrieval

    /// The cloud configuration retrieved from the server is malformed and cannot be decoded
    case cloudConfigurationMalformed

    /// The provider app declares prohibited TCC usage description keys (e.g. location)
    case prohibitedTCCKeysFound

Truncated.

extension

AppManagedFeaturesError

NewiOS
extension AppManagedFeaturesError : LocalizedError

Extends App Managed Features errors by adding localized descriptions

Declaration
extension AppManagedFeaturesError : LocalizedError {

    /// The localized description of the error.
    public var errorDescription: String? { get }
}
extension

AppManagedFeaturesError

NewiOS
extension AppManagedFeaturesError : Equatable
Declaration
extension AppManagedFeaturesError : Equatable {
}
extension

AppManagedFeaturesError

NewiOS
extension AppManagedFeaturesError : Hashable
Declaration
extension AppManagedFeaturesError : Hashable {
}
extension

AppManagedFeaturesError

NewiOS
extension AppManagedFeaturesError : RawRepresentable
Declaration
extension AppManagedFeaturesError : RawRepresentable {
}
actor

FeatureManager

NewiOS
public actor FeatureManager
Declaration
public actor FeatureManager {

    public static let shared: FeatureManager

    public var isLocked: Bool { get async throws }

    public func lock(restrictions: Restrictions) async throws

    public func unlock() async throws

    public func setSoftwareUpdateRequirement(_ requirement: SoftwareUpdateRequirement?) async throws

    public var softwareUpdateRequirement: SoftwareUpdateRequirement? { get async throws }

    @objc deinit

    /// Retrieve the executor for this actor as an optimized, unowned
    /// reference.
    ///
    /// This property must always evaluate to the same executor for a
    /// given actor instance, and holding on to the actor must keep the
    /// executor alive.
    ///
    /// This property will be implicitly accessed when work needs to be
    /// scheduled onto this actor.  These accesses may be merged,
    /// eliminated, and rearranged with other work, and they may even
    /// be introduced when not strictly required.  Visible side effects
    /// are therefore strongly discouraged within this property.
    ///
    /// - SeeAlso: ``SerialExecutor``
    /// - SeeAlso: ``TaskExecutor``
    nonisolated final public var unownedExecutor: UnownedSerialExecutor { get }
}
struct

Restrictions

NewiOS
public struct Restrictions : Codable, Sendable, Equatable, Hashable, CustomStringConvertible
Declaration
public struct Restrictions : Codable, Sendable, Equatable, Hashable, CustomStringConvertible {

    ///  An array of bundle IDs to exclude from the lock operation
    public let excludingApps: [String]

    /// Adds additional apps to the deny list. This can be used to deny an app that was implicitly allowed because
    /// it has a critical alert entitlement.
    public let includingApps: [String]

    /// Adds additional web domains to the allow list. As a default, all web domains will be blocked in WebKit views
    /// and WebKit based browsers.
    public let excludingWebDomains: [String]

    /// Creates a new `Restrictions` instance specifying which apps and web domains are exempt from device restrictions.
    ///
    /// - Parameters:
    ///   - excludingApps: An array of bundle IDs for apps to exclude from the lock operation. These apps remain
    ///     accessible even when device restrictions are active. Defaults to an
    ///     empty array.
    ///   - includingApps: An array of bundle IDs to add to the deny list. Use this to explicitly deny apps that
    ///     would otherwise be implicitly allowed, such as apps with a critical alert entitlement. Defaults to an
    ///     empty array.
    ///   - excludingWebDomains: An array of web domains to add to the allow list. By default, all web domains are
    ///     blocked in WebKit views and WebKit-based browsers when restrictions are active. Defaults to an empty array.
    public init(excludingApps: [String] = [], includingApps: [String] = [], excludingWebDomains: [String] = [])

    /// A human-readable representation of the restrictions, listing all excluded apps, included apps, and excluded web domains.
    public var description: String { get }

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: Restrictions, b: Restrictions) -> Bool

    /// Encodes this value into the given encoder.
    ///
    /// If the value fails to encode anything, `encoder` will encode an empty
    /// keyed container in its place.
    ///
    /// This function throws an error if any values are invalid for the given
    /// encoder's format.
    ///
    /// - Parameter encoder: The encoder to write data to.
    public func encode(to encoder: any Encoder) throws

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }

    /// Creates a new instance by decoding from the given decoder.
    ///
    /// This initializer throws an error if reading from the decoder fails, or

Truncated.

struct

SoftwareUpdateRequirement

NewiOS
public struct SoftwareUpdateRequirement : Codable, Sendable, Hashable, CustomStringConvertible

A requirement for the device to install a specific software update by a given deadline.

This value is provided to the activation extension to communicate that the managing app requires the device to be updated to a minimum OS version before a certain date.

Declaration
public struct SoftwareUpdateRequirement : Codable, Sendable, Hashable, CustomStringConvertible {

    /// The minimum OS version the device must be running.
    public let targetOSVersion: String

    /// An optional specific build version the device must be running.
    ///
    /// When `nil`, any build of `targetOSVersion` satisfies the requirement.
    public let targetBuildVersion: String?

    /// The date by which the device must have installed the required software update.
    public let deadline: Date

    /// Creates a new software update requirement.
    ///
    /// - Parameters:
    ///   - targetOSVersion: The minimum OS version the device must be running.
    ///   - targetBuildVersion: An optional specific build version. Pass `nil` to accept any build of `targetOSVersion`.
    ///   - deadline: The date by which the update must be installed.
    public init(targetOSVersion: String, targetBuildVersion: String?, deadline: Date)

    /// A human-readable representation of the software update requirement.
    ///
    /// Returns a formatted string containing all fields of the requirement, including the
    /// target OS version, optional build version, and deadline.
    public var description: String { get }

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: SoftwareUpdateRequirement, b: SoftwareUpdateRequirement) -> Bool

    /// Encodes this value into the given encoder.
    ///
    /// If the value fails to encode anything, `encoder` will encode an empty
    /// keyed container in its place.
    ///
    /// This function throws an error if any values are invalid for the given
    /// encoder's format.
    ///
    /// - Parameter encoder: The encoder to write data to.
    public func encode(to encoder: any Encoder) throws

    /// Hashes the essential components of this value by feeding them into the
    /// given hasher.
    ///
    /// Implement this method to conform to the `Hashable` protocol. The
    /// components used for hashing must be the same as the components compared
    /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
    /// with each of these components.
    ///
    /// - Important: In your implementation of `hash(into:)`,
    ///   don't call `finalize()` on the `hasher` instance provided,
    ///   or replace it with a different instance.
    ///   Doing so may become a compile-time error in the future.
    ///
    /// - Parameter hasher: The hasher to use when combining the components
    ///   of this instance.
    public func hash(into hasher: inout Hasher)

    /// The hash value.
    ///
    /// Hash values are not guaranteed to be equal across different executions of
    /// your program. Do not save hash values to use during a future execution.
    ///
    /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
    ///   conform to `Hashable`, implement the `hash(into:)` requirement instead.
    ///   The compiler provides an implementation for `hashValue` for you.
    public var hashValue: Int { get }

    /// Creates a new instance by decoding from the given decoder.
    ///
    /// This initializer throws an error if reading from the decoder fails, or
    /// if the data read is corrupted or otherwise invalid.
    ///

Truncated.

typealias

AppManagedFeaturesError.RawValue

NewiOS
public typealias RawValue = Int

The raw type that can be used to represent all values of the conforming type.

Every distinct value of the conforming type has a corresponding unique value of the RawValue type, but there may be values of the RawValue type that don't have a corresponding value of the conforming type.

No APIs match your filter.

← More in App Services, Foundation & Diagnostics