🍣

EAAccessoryManager

2020/10/16に公開

これは以下の意訳である。
https://developer.apple.com/documentation/externalaccessory/eaaccessorymanager

EAAccessoryManager

EAAccessoryManagerはデバイスに接続されているアクセサリをマネージする。共有のEAAccessoryManagerを用いて接続されているアクセサリを取得したり、接続、切断
の通知を開始したり停止したりできる。

Topics

class func shared() -> EAAccessoryManager
func registerForLocalNotifications()
func unregisterForLocalNotifications()

これらより以下の通知がやってくる。

static let EAAccessoryDidConnect: NSNotification.Name
static let EAAccessoryDidDisconnect: NSNotification.Name

この通知には以下の情報が入っている。

let EAAccessoryKey: String
let EAAccessorySelectedKey: String

対応するEAAccessoryが得られる。

Bluetooth Pickerを出す。

func showBluetoothAccessoryPicker(withNameFilter: NSPredicate?, completion: EABluetoothAccessoryPickerCompletion?)

プロパティ

現在接続しているアクセサリ

var connectedAccessories: [EAAccessory]

UISupportedExternalAccessoryProtocols

アプリが使うプロトコルをInfo.plistで指定する。

Discussion