Can you try this feature?
- (void)_getAttachedDevices; { EAAccessoryManager* accessoryManager = [EAAccessoryManager sharedAccessoryManager]; if (accessoryManager) { NSArray* connectedAccessories = [accessoryManager connectedAccessories]; NSLog(@"ConnectedAccessories = %@", connectedAccessories); } else { NSLog(@"No accessoryManager"); } }
What result do you get?
Obviously, remember that EAAccessory is for licensed Made-For-iPod / iPhone / iPad / AirPlay accessories only; therefore, if you do not have a licensed accessory, you will always see an empty array. Do you have a regular MFI licensed accessory?
Depending on if you have not read its Apple Documentation .
EDIT 1:
If you are still stuck, try a notification to connect / disconnect:
[[EAAccessoryManager sharedAccessoryManager] registerForLocalNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accessoryDidConnect:) name:EAAccessoryDidConnectNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accessoryDidDisconnect:) name:EAAccessoryDidDisconnectNotification object:nil];
Do you see the connection for your device? If yes, try to get a list of connected devices on
accessoryDidConnect
Massimo polimeni
source share