Class

NSFileProviderService

A service that provides a custom communication channel between your app and a File Provider extension. あなたのアプリとファイルプロバイダ拡張との間のあつらえの通信経路を提供するサービス。

Declaration 宣言

class NSFileProviderService : NSObject

Overview 概要

To communicate, both your app and the File Provider extension must implement their part of the service: 通信するには、あなたのアプリとファイルプロバイダ拡張の両方が、これらのサービスの部分を実装しなければなりません:

  • Your app requests the proxy object, and calls its methods. あなたのアプリはプロキシオブジェクトをリクエストします、そしてそれのメソッドを呼び出します。

  • The File Provider extension declares the supported services and vends a proxy object that implements the protocol for each service. ファイルプロバイダ拡張は、サポートされるサービスを宣言します、そして各サービスに対するプロトコルを実装するプロキシオブジェクトを供給します。

The app and File Provider extension communicate using an XPC service. This service performs actions only on items managed by the File Provider extension. For more information, see Creating XPC Services. アプリとファイルプロバイダ拡張は、XPCサービスを使って通信します。このサービスは、ファイルプロバイダ拡張によって管理される項目上でのみアクションを実行します。さらなる情報として、Creating XPC Servicesを見てください。

Defining the Service’s Protocol サービスのもつプロトコルを定義する

Services let you define custom actions that are not provided by Apple’s APIs. Both the app and the File Provider extension must agree upon the service’s name and protocol. Communicate the name and protocol through an outside source (for example, posting a header file that defines both the name and protocol, or publishing an library that includes them both). サービスは、AppleのAPIによって提供されないあつらえのアクションをあなたに定義させます。アプリとファイルプロバイダ拡張の両方は、サービスそれらのもつ名前とプロトコルに関して合意しなければなりません。外部ソースを通して名前とプロトコルを伝達してください(例えば、名前とプロトコルの両方を定義するヘッダファイルを公示する、またはそれらの両方を含むライブラリを発行する)。

The service can be defined by either the app or the File Provider extension: サービスは、アプリまたはファイルプロバイダ拡張のどちらかで定義できます:

  • Apps can define a service for features they would like to use. File providers can then choose to support those features by implementing the service. アプリは、人々が使いたいであろう特徴それらに対してあるサービスを定義できます。ファイルプロバイダは、それからそのサービスを実装することによってそれらの機能をサポートするようにできます。

  • File Provider extensions can provide a service for the features they support. Apps can then choose to use the specified service. ファイルプロバイダ拡張は、それがサポートする機能それらに対してあるサービスを提供できます。アプリは、それから指定されたサービスを使うようにできます。

When defining a service’s protocol, the parameters for each method must adhere to the following rules: あるサービスのもつプロトコルを定義する時、各メソッドに対するパラメータは以下の規則に忠実でなければなりません:

  • The parameter’s class must conform to NSSecureCoding. パラメータのもつクラスは、NSSecureCodingに準拠しなければなりません。

  • The parameter’s class must be defined in both the app and the File Provider extension (for example, standard system types or classes defined in a library imported by both sides). パラメータのもつクラスは、アプリとファイルプロバイダ拡張の両方において定義されなければなりません(例えば、両方の側によってインポートされるあるライブラリにおいて定義される標準システム型またはクラス)。

  • If a collection parameter contains types other than property list types (see Property List Types and Objects), declare the valid types using the NSXPCInterface class’s classes(for:argumentIndex:ofReply:) method. コレクションパラメータがプロパティリスト型(Property List Types and Objectsを見てください)以外の型を含むならば、NSXPCInterfaceクラスのもつclasses(for:argumentIndex:ofReply:)メソッドを使って有効な型を宣言してください。

Topics 話題

Accessing the Service サービスにアクセスする

Relationships 関係

Inherits From 継承元

See Also 参照

Accessing File Provider Services ファイルプロバイダサービスにアクセスする