No EAAccessoryDidConnectNotification and EAAccessoryDidDisconnectNotification after connecting Lightning kBD or Smart KBD
Asked Answered
I

5

16

I could not get these two notifications EAAccessoryDidConnectNotification and EAAccessoryDidDisconnectNotification after connecting Lightning kBD or Smart KBD with my APP. But it worked on iOS9.3 with my code as below,

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_accessoryDidConnect:) name:EAAccessoryDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_accessoryDidDisconnect:) name:EAAccessoryDidDisconnectNotification object:nil];
[[EAAccessoryManager sharedAccessoryManager] registerForLocalNotifications];

What's the cause?

P.S.: I got this following message in the logs. Couldn't find the "com.apple.private.externalaccessory.showallaccessories" entitlement

Itemize answered 19/8, 2016 at 3:33 Comment(5)
I recently stumbled upon the same behavior with the same log, could you find the cause ?Melia
Same problem here, including the "com.apple.private.externalaccessory.showallaccessories" message. Any light shed on this problem?Mcclary
Any solution till now ?Enforcement
Anyone have an update? I've tried every suggestion I can find and some other stuff to boot. It's crazy to me that this issue has been known for at least four months and there doesn't seem to be a solid fix (nor does it appear to have been resolved as of 10.1.1). The thread on the Apple developer forum doesn't have any additional insight. This is critical to my company and we're not the only ones with an MFI product out there!Marleah
Found this post on the apple forum: forums.developer.apple.com/thread/61646 on Dec 7, 2016 4:56 PM, Rich (Apple employee) gives some info on this. It seems the protocol in now (iOS 10) validated case sensitive.Marquand
J
0

I deleted the "iOS Team provisioning profile: *" in Xcode->preferences->accounts->-> view details.

As soon as you delete that profile a fresh copy is downloaded. Since then I don't see this "Couldn't find the com.apple.private.externalaccessory.showallaccessories entitlement" anymore. I am guessing this entitlement is now in the "iOS Team provisioning profile: *". If your bundle ID is present in other "iOS Team provisioning profile" then I would recommend to delete those provisioning profile too.

Jural answered 15/9, 2016 at 23:16 Comment(2)
Now that you're not getting the error message, are you able to enumerate paired BT devices via [[EAAccessoryManager sharedAccessoryManager] connectedAccessories]? If so, which services/capabilities are enabled for your app? Thanks!Mcclary
I didn't have any issue even with the error message, and yes I am using the sharedAccessoryManager connectedAccessories. The Capabilities are all turned off. My accessories is a Classic Bluetooth Barcode scanner.Jural
C
0

It seems the issue is well known in iOS 10(beta) versions as we don't have stable release available, This seems to be resolved in stable release of iOS 10. Its also raised on Apple Developer Forum as well, but no concrete solution.

Though i tried a few different things to fix this, but ended up doing this, which worked:

  1. Clean
  2. Clean Build Folder
  3. Delete and re-link ExternalAccessory.framework
  4. Delete app on iOS device
  5. Build and run

If this doesn't work, try deleting and generating a new provisioning profile for your app.

Cyprinid answered 21/9, 2016 at 8:49 Comment(0)
W
0

Here is my experience. On Xcode 8.1 I can successfully build an old NIB-based Apple project (EADemo) and run it on iOS 10.1.1 device. It works fine with my Bluetooth accessory. Then I renamed the project folder and completed the porting to a Storyboard-based project. Running the app on the same iPhone the EA Session crashes and I get the error log:

2016-11-29 17:04:00.804421 K5Demo[430:69578] Couldn't find the "com.apple.private.externalaccessory.showallaccessories" entitlement 2016-11-29 17:04:04.736780 K5Demo[430:69578] ERROR - opening session failed as protocol (null) is not declared in Info.plist

For the two cases the Info.plist file is the same, and also the iOS version.

Welcy answered 29/11, 2016 at 17:46 Comment(0)
H
-3

You can try deleting and generating a new provisioning profile for your app.

In iOS 10 Apple has two new requirement so that your app can receive EAAccessoryDidConnectNotification and EAAccessoryDidDisconnectNotification notifications, and can list devices via [[EAAccessoryManager sharedAccessoryManager] connectedAccessories].

Include a protocolString of the external accessory in your app's UISupportedExternalAccessoryProtocols property list.

Have the external accessory's manufacturer submit to Apple a request for MFi whitelisting of your app.

For debug, only (1) is needed. But your app will not be approved by Apple (probably not even for TestFlight) without (2).

Herakleion answered 22/9, 2016 at 12:21 Comment(1)
Please do not copy another user's answer into yours, without correctly referencing the content; see stackoverflow.com/help/referencing. However, in this case, I'm not sure why you copied the content at all, as your answer stands alone from it, so I have edited out the copied content.Feeble
M
-3

In iOS 10 Apple has two new requirement so that your app can receive EAAccessoryDidConnectNotification and EAAccessoryDidDisconnectNotification notifications, and can list devices via [[EAAccessoryManager sharedAccessoryManager] connectedAccessories].

  1. Include a protocolString of the external accessory in your app's UISupportedExternalAccessoryProtocols property list.

  2. Have the external accessory's manufacturer submit to Apple a request for MFi whitelisting of your app.

For debug, only (1) is needed. But your app will not be approved by Apple (probably not even for TestFlight) without (2).

Mcclary answered 22/9, 2016 at 12:45 Comment(7)
Thanks. Any documentation on this? Where did you hear about it?Satem
Mike, from developer.apple.com/library/content/featuredarticles/… plus a conversation with an accessory's manufacturer.Mcclary
Really weird this answer has been accepted, does it solve something for somebody ? To me these requirements aren't new, and having them did not prevent the bug from happening. I'll bet on an apple bug and a little birdie told me to hope and wait for next iOS 10 minor releaseMelia
@AnderCover, it certainly solved the problem for me. No needs for little birdies.Mcclary
@Mcclary do you realize you're calling UISupportedExternalAccessoryProtocols - a UIKit Key introduced that's been around since iOS 3.0 if I believe the Apple Doc developer.apple.com/library/content/documentation/General/… - a "new requirement" ?Melia
@AnderCover, your combative tone aside, our app received EAAccessoryDidConnectNotification and EAAccessoryDidDisconnectNotification notifications from paired/connected external bluetooth GPS devices until iOS 10, without using UISupportedExternalAccessoryProtocols and without whitelisting. This stopped working in iOS 10. Adding UISupportedExternalAccessoryProtocols and whitelisting fixed the app under iOS 10.Mcclary
@Mcclary well you can stick to your opinion I don't care. I had this issue and it has been fixed in iOS 10.1. FYI my project already included UISupportedExternalAccessoryProtocols in the plist and my company was already whitelisted. So saying it's a new requirement is actually just plain wrong, and you should at least edit your answer instead of complaining about my "combative tone". That's what I call intellectual honesty.Melia

© 2022 - 2024 — McMap. All rights reserved.