Contents

fetchData(forBundleIdentifier:itemIdentifier:contentType:completionHandler:)

Fetches data from an external provider.

Declaration

func fetchData(forBundleIdentifier bundleIdentifier: String, itemIdentifier: String, contentType: UTType, completionHandler: @escaping  @Sendable (Data?, (any Error)?) -> Void)
func fetchData(forBundleIdentifier bundleIdentifier: String, itemIdentifier: String, contentType: UTType) async throws -> Data

Parameters

  • bundleIdentifier:

    The bundle identifier of the app to search.

  • itemIdentifier:

    The app-specific identifier of the item you want.

  • contentType:

    The type of data to fetch.

  • completionHandler:

    The block to execute with the results. The block has no return value and takes the following parameters:

    data

    The data for the specified item, if successful.

    error

    An error object, or nil if the method retrieved the data successfully.

Discussion

Clients with the appropriate entitlements can use this method to fetch data from an external app such as Mail.