Class

DistributedNotificationCenter

A notification dispatch mechanism that enables the broadcast of notifications across task boundaries. タスク境界を横切って通知の放送を可能にする通知ディスパッチの仕組み。

Declaration 宣言

class DistributedNotificationCenter : NotificationCenter

Overview 概要

A DistributedNotificationCenter instance broadcasts NSNotification objects to objects in other tasks that have registered for the notification with their task’s default distributed notification center. DistributedNotificationCenterインスタンスは、NSNotificationオブジェクトを他のタスクの中のオブジェクトそれらに対して放送します、それらは、それらのタスクの持つ省略時の分散通知センターを使って、通知に対して登録されます。

Principal Attributes プリンシパル属性

Commonly Used Methods 頻繁に使われるメソッド

default()

Accesses the default distributed notification center. 省略時の分散通知センターにアクセスします。

addObserver(_:selector:name:object:suspensionBehavior:)

Registers an object to receive a notification with a specified behavior when notification delivery is suspended. 通知配達が待機させられる場合に指定される挙動とともに、オブジェクトを登録して通知を受け取るようにします。

postNotificationName(_:object:userInfo:deliverImmediately:)

Creates and posts a notification. 通知を作成して投函します。

removeObserver(_:name:object:)

Specifies that an object no longer wants to receive certain notifications. あるオブジェクトがもはや特定の通知の受け取りを望まないことを指定します。

Overview 概要

Each task has a default distributed notification center that you access with the default() class method. There may be different types of distributed notification centers. Currently there is a single type—NSLocalNotificationCenterType. This type of distributed notification center handles notifications that can be sent between tasks on a single computer. For communication between tasks on different computers, use Distributed Objects Programming Topics. 各タスクは、異なる分散通知センターを持ちます、それはあなたがdefault()クラスメソッドを使ってアクセスします。分散通知センターの異なる型があるかもしれません。現在はただ1つの型 — NSLocalNotificationCenterTypeがあります。この型の分散通知センターは、単一のコンピュータ上のタスク間で送られることができる通知を取り扱います。異なるコンピュータ上のタスク間通信については、Distributed Objects Programming Topicsを使ってください。

Posting a distributed notification is an expensive operation. The notification gets sent to a system-wide server that distributes it to all the tasks that have objects registered for distributed notifications. The latency between posting the notification and the notification’s arrival in another task is unbounded. In fact, when too many notifications are posted and the server’s queue fills up, notifications may be dropped. 分散通知を投函することは、高くつく業務です。通知は、いろいろな分散通知に登録されるいろいろなオブジェクトを持つタスク全てにそれを分散する、あるシステムワイドサーバに送られます。通知の投函と、別タスクでの通知到着との間の待ち時間は、限界がありません。実際、多すぎる通知が投函されるそしてサーバーのクエリがいっぱいになる場合、通知はボツにされるかもしれません。

Distributed notifications are delivered via a task’s run loop. A task must be running a run loop in one of the “common” modes, such as NSDefaultRunLoopMode, to receive a distributed notification. For multithreaded applications running in macOS 10.3 and later, distributed notifications are always delivered to the main thread. For multithreaded applications running in OS X v10.2.8 and earlier, notifications are delivered to the thread that first used the distributed notifications API, which in most cases is the main thread. 分散通知は、あるタスクの持つ実行ループ経由で配達されます。あるタスクは、分散通知を受け取るために、ある実行ループを “通常” モードの1つ、例えばNSDefaultRunLoopModeにおいて実行中でなければなりません。macOS 10.3以降で動作しているマルチスレッドアプリケーションに対して、分散通知は常にメインスレッドに配達されます。OS X v10.2.8以前で動作しているマルチスレッドアプリケーションに対して、通知は、最初に分散通知APIを使ったスレッド、ほとんどの場合メインスレッド、に配達されます。

Topics 話題

Getting Distributed Notification Centers 分散通知センターを取得する

Managing Observers オブザーバを管理する

Posting Notifications 通知を投函する

Suspending and Resuming Notification Delivery 通知配達の待機と再開

Constants 定数

Relationships 関係

Inherits From 継承元