External Accessory Framework - giving me multiple device connect notifications
I've started working with the External Accessory Framework and the Apple Camera Connector. I've got some barebones code working but am seeing some odd behavior.
Basically: when I connect the Camera Connector, I get three events - EAAccessoryDidConnectNotification - EAAccessoryDidDisconnectNotification - EAAccessoryDidConnectNotification
So it sees the device connecting, then disconnecting, then connecting. I've tried manually connecting the device slowly, quickly, etc. - doesn't make a difference.
The code I am using to set up notifications is boilerplate (below). Is there any known reason why I might be getting that connection hiccup?
(fwiw - I am planning to use this with the Bass MIDI lib to determine when a keyboard has been connected/disconnected).
--thanks!
- (void)viewWillAppear:(BOOL)animated
{
// watch for the accessory being connected
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_accessoryDidConnect:)
name:EAAccessoryDidConnectNotification
object:nil];
// watch for the accessory being disconnected
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_accessoryDidDisconnect:)
name:EAAccessoryDidDisconnectNotification
object:nil];
[[EAAccessoryManager sharedAccessoryM开发者_开发知识库anager] registerForLocalNotifications];
}
精彩评论