New
12protocol
PHBackgroundResourceUploadJobExtension
NewiOSmacOSpublic protocol PHBackgroundResourceUploadJobExtension : AppExtension
Declaration
public protocol PHBackgroundResourceUploadJobExtension : AppExtension {
/// Request to initiate processing background upload jobs.
/// - Returns: A result type of ``PHBackgroundResourceUploadProcessingResult`` based on the state of the processing task.
func processJobs() async -> PHBackgroundResourceUploadProcessingResult
/// Called by the host before suspending or terminating the extension process. Extension clients should use this to
/// stop any in-progress work. When the extension is activated again, a new call will be made by the host.
func willTerminate() async
}
extension
PHBackgroundResourceUploadJobExtension
NewiOSmacOSextension PHBackgroundResourceUploadJobExtension
Declaration
extension PHBackgroundResourceUploadJobExtension {
public var configuration: some AppExtensionConfiguration { get }
}
enum
PHBackgroundResourceUploadProcessingResult
NewmacOSpublic enum PHBackgroundResourceUploadProcessingResult : Int
Declaration
public enum PHBackgroundResourceUploadProcessingResult : Int {
/// the extension failed the processing task with an error
case failure
/// the extension has only partially completed its processing and still requires more time
case processing
/// the extension has completed all processing required and is up to date with the photos library
case completed
/// Creates a new instance with the specified raw value.
///
/// If there is no value of the type that corresponds with the specified raw
/// value, this initializer returns `nil`. For example:
///
/// enum PaperSize: String {
/// case A4, A5, Letter, Legal
/// }
///
/// print(PaperSize(rawValue: "Legal"))
/// // Prints "Optional(PaperSize.Legal)"
///
/// print(PaperSize(rawValue: "Tabloid"))
/// // Prints "nil"
///
/// - Parameter rawValue: The raw value to use for the new instance.
public init?(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.
@available(macOS 27.0, iOS 26.1, macCatalyst 27.0, *)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
@available(visionOS, unavailable)
public typealias RawValue = Int
/// The corresponding value of the raw type.
///
/// A new instance initialized with `rawValue` will be equivalent to this
/// instance. For example:
///
/// enum PaperSize: String {
/// case A4, A5, Letter, Legal
/// }
///
/// let selectedSize = PaperSize.Letter
/// print(selectedSize.rawValue)
/// // Prints "Letter"
///
/// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
/// // Prints "true"
public var rawValue: Int { get }
}
extension
PHBackgroundResourceUploadProcessingResult
NewmacOSextension PHBackgroundResourceUploadProcessingResult : Equatable
Declaration
extension PHBackgroundResourceUploadProcessingResult : Equatable {
}
extension
PHBackgroundResourceUploadProcessingResult
NewmacOSextension PHBackgroundResourceUploadProcessingResult : Hashable
Declaration
extension PHBackgroundResourceUploadProcessingResult : Hashable {
}
extension
PHBackgroundResourceUploadProcessingResult
NewmacOSextension PHBackgroundResourceUploadProcessingResult : RawRepresentable
Declaration
extension PHBackgroundResourceUploadProcessingResult : RawRepresentable {
}
func
setUploadJobExtensionEnabled
NewmacOSopen func setUploadJobExtensionEnabled(_ enable: Bool) throws
Enables or disables the background asset resource upload job feature.
You must call this function before you create PHAssetResourceUploadJob in the extension's host application.
To enable background uploads, you must have both full library access and register the extension with the extension point: "com.apple.photos.background-upload".
Parameters
enabletrue allows calls to the extension's host application; you can fulfill that protocol to create PHAssetResourceUploadJob objects. false stops calls to the extension's host application.error- if either enabling or disabling was unsuccessful,
false is returned and an error is set on the error parameter.
var
uploadJobExtensionEnabled
NewmacOSopen var uploadJobExtensionEnabled: Bool { get }
A Boolean value that indicates whether background asset resource uploading is enabled.
The value is true if the extension is enabled and active, and is false otherwise.
The extension's host app uses this property to determine the background processing status. See PHAssetResourceUploadJob and ``PHAssetResourceUploadJobChangeRequest for more information.
enum
PHAssetResourceUploadJob.Action
NewmacOSpublic enum Action : Int, @unchecked Sendable
An action to perform on an upload job.
Determine the available jobs for an action by calling the fetchJobsWithAction:options: method.
Declaration
public enum Action : Int, @unchecked Sendable {
/// A job that requires acknowledgement.
///
/// An acknowledgeable job has a ``PHAssetResourceUploadJob/state`` of `succeeded` or `failed`
/// and hasn't been acknowledged.
///
/// Call ``PHAssetResourceUploadJobChangeRequest/acknowledge`` to acknowledge a job
/// and free queue capacity for new uploads.
@available(macOS 10.11, *)
case acknowledge = 1
/// A job to retry processing.
///
/// A retryable job has a ``PHAssetResourceUploadJob/state`` of `failed` and hasn't previously been retried.
///
/// Call ``PHAssetResourceUploadJobChangeRequest/retryWithDestination:`` to retry the job.
@available(macOS 10.11, *)
case retry = 2
/// A job to process.
///
/// A processable job has a ``PHAssetResourceUploadJob/state`` of `registered` or `pending`.
@available(macOS 10.11, *)
case process = 3
}
enum
PHAssetResourceUploadJob.State
NewmacOSpublic enum State : Int, @unchecked Sendable
The states of an upload job.
Declaration
public enum State : Int, @unchecked Sendable {
/// The job has been registered.
@available(macOS 10.11, *)
case registered = 1
/// A request has been made to send the asset resource to the destination, but has not yet been fulfilled.
@available(macOS 10.11, *)
case pending = 2
/// The job has failed to send over.
@available(macOS 10.11, *)
case failed = 3
/// The job has sent over successfully.
@available(macOS 10.11, *)
case succeeded = 4
/// The job has been cancelled.
@available(macOS 10.11, *)
case cancelled = 5
}
enum
PHAssetResourceUploadJob.Type
NewmacOSpublic enum `Type` : Int16, @unchecked Sendable
The types of an upload job
Declaration
public enum `Type` : Int16, @unchecked Sendable {
/// An upload job type (will download the resource from iCloud if required. then upload)
@available(macOS 10.11, *)
case upload = 0
/// A download job type (will download the resource from iCloud if required)
@available(macOS 10.11, *)
case downloadOnly = 1
}
typealias
PHBackgroundResourceUploadProcessingResult.RawValue
NewmacOSpublic 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.