The External Accessory framework is capable of sending notifications whenever a hardware accessory is connected or disconnected. Although it is capable, it does not do so automatically. Your application must specifically request that notifications be generated by calling the registerForLocalNotifications
method of the EAAccessoryManager
class. When an accessory is connected, authenticated, and ready to interact with your application, the framework sends an EAAccessoryDidConnectNotification
notification. When an accessory is disconnected, it sends an EAAccessoryDidDisconnectNotification
notification. You can register to receive these notifications using the default NSNotificationCenter
, and both notifications include information about which accessory was affected.
In addition to receiving notifications through the default notification center, an application that is currently interacting with an accessory can assign a delegate to the corresponding EAAccessory
object and be notified of changes. Delegate objects must conform to the EAAccessoryDelegate
protocol, which currently contains the optional accessoryDidDisconnect:
method. You can use this method to receive disconnection notices without first setting up a notification observer.
If your application is suspended in the background when an accessory notification arrives, that notification is put in a queue. When your application begins running again (either in the foreground or background), notifications in the queue are delivered to your application. Notifications are also coalesced and filtered wherever possible to eliminate any irrelevant events. For example, if an accessory was connected and subsequently disconnected while your application was suspended, your application would ultimately not receive any indication that such events took place.
For more information about how to register to receive notifications, see Notification Programming Topics.
Last updated: 2010-05-26