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

Leo Natan
  • 55,734
  • 8
  • 140
  • 186
Ting
  • 169
  • 1
  • 4
  • I recently stumbled upon the same behavior with the same log, could you find the cause ? – AnderCover Aug 25 '16 at 16:56
  • Same problem here, including the "com.apple.private.externalaccessory.showallaccessories" message. Any light shed on this problem? – cshavit Sep 17 '16 at 17:18
  • Any solution till now ? – Mridul Gupta Nov 10 '16 at 13:58
  • 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! – Reid Dec 07 '16 at 16:08
  • Found this post on the apple forum: https://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. – Peter Visser Dec 12 '16 at 16:59

5 Answers5

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.

EricG
  • 144
  • 4
  • 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! – cshavit Sep 19 '16 at 01:13
  • 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. – EricG Sep 21 '16 at 14:25
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.

Dipen Panchasara
  • 12,717
  • 5
  • 45
  • 56
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.

-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).

Matt
  • 70,063
  • 26
  • 142
  • 172
Zak The Hat
  • 207
  • 5
  • 14
  • 1
    Please do not copy another user's answer into yours, without correctly referencing the content; see http://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. – Matt Oct 12 '16 at 19:14
-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).

cshavit
  • 414
  • 2
  • 11
  • Thanks. Any documentation on this? Where did you hear about it? – Mike Sep 22 '16 at 19:09
  • Mike, from https://developer.apple.com/library/content/featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html plus a conversation with an accessory's manufacturer. – cshavit Sep 22 '16 at 20:49
  • 1
    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 release – AnderCover Sep 23 '16 at 15:09
  • @AnderCover, it certainly solved the problem for me. No needs for little birdies. – cshavit Nov 17 '16 at 21:25
  • 1
    @cshavit 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 https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW10 - a "new requirement" ? – AnderCover Nov 17 '16 at 21:49
  • @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. – cshavit Nov 19 '16 at 01:25
  • 1
    @cshavit 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. – AnderCover Nov 24 '16 at 13:40