Multipeer Connectivity in iOS 10 (Bluetooth Issues)

I have an app that has been in production for 3 years. It uses MPC to connect remotes (iphones/ipods) to an iPad for sports scoring.


In testing with iOS 10 (now on GM), I have come across the following issue:


The app works fine when all devices are on using WiFi only, i.e. everything connects. When I put all devices into Bluetooth only, I get a connect failure.


Here is my invitation code:


[_servicebrowser invitePeer:peerID toSession:_session withContext:nil timeout:30];


Here is my connection code on the iPad:


  1. -(void)advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void (^)(BOOL, MCSession *))invitationHandler
  2. {
  3. if (_serverState == ServerStateAcceptingConnections && [self connectedClientCount] < self.maxClients)
  4. {
  5. NSLog(@"MatchmakingServer: Connection accepted from peer %@", peerID);
  6. invitationHandler (true, _session);
  7. }
  8. else
  9. {
  10. invitationHandler (false, _session);
  11. }
  12. }
  13. -(void)session:(MCSession *)session didReceiveCertificate:(NSArray *)certificate fromPeer:(MCPeerID *)peerID certificateHandler:(void (^)(BOOL))certificateHandler
  14. {
  15. certificateHandler (true);
  16. }


Here is the issue:


When using WiFi (Bluetooth turned off on all devices), the didReceiveCertificate method is called and passes as usual. When using only Bluetooth(WiFi off on all devices), this method is never called and the console gives the following message:


Advertiser got invite with nil connectionData.

Data from peer [Steve's iPhone,09D0CE9E] received with error Connection closed.


The connection then fails.


This is a huge problem for me as my clients rely on Bluetooth connectsion as well as WiFi.


What has changed???? The exact same code is being executed for WiFi or Bluetooth.

Post not yet marked as solved Up vote post of smcarther Down vote post of smcarther
19k views

Replies

It looks like 10.1 Beta 2 fixes the issue! 🙂

Instead of upgrading to beta version 10.1 Beta 2, is there any workaround to solve this issue? 😢


I got the same error by using MPC.


[ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (905548892)

I just tested it with iOS 10.1 Beta 4. 😟

But it still doesn't connect on Bluetooth-Only, at least not to another device with iOS 9.3.5.

Problem (Only bluetooth connectivity) still exits after iOS 10.1 release. Is there any workaround for this? I am looking at enterprise application which need not be in appstore.

So even if the workaround is using unpublished system component/library, we are ok using it.

I am also getting this issue on my test app between Mac OS X Sierra running on a MacBook Pro and iOS 10.1 running on an iPhone 5c, but I'm getting it even over Wi-Fi.


On the OS X side, I'm getting: [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (309651737)

and it loses connection.


On the iOS side, I'm getting: [AGPSession] Couldn't check in handle iDstIDs (0).

as well as [GCKSession] Not in connected state, so giving up for participant [5F2C221B] on channel [0]

Have tried all the various suggestions above (e.g. authentication)

Does anyone have updates of this issue ?

If you had, could you share it with us ?

Seconded. I am having the same issue still. Wondering if there is a fix coming soon?

I actually had implemented a stub for a method and when I deleted it, the app started working for me again.


http://stackoverflow.com/questions/34393372/multipeer-connectivity-framework-not-connecting-anymore


Thank you for your information!!

I remvoed "session:didReceiveCertificate:fromPeer:certificateHandler" method from my code as your link page describes, however, it still doesn't work.


Could you tell me which ios version you are using for ?

Does your app working even when Bluetooth only ?


Thank you.

I have found out new info.

I am using two iPhones (iOS 10.2).

I started advertising and browsing in "applicationDidBecomeActive" method in AppDelegate file before and it didn't work for multipeerconnectivity.

The connectivity is unstable.

When I started them in "viewDidAppear" method in the view controller file of first launching view, it worked perfectly even when wifi is off (bluetooth only) !!

I don't understand why it works well...

I hope this info is beneficial for you.


Thanks.

Same problem.


Using iPhone 6S with 10.2 & iPhone 6 with 9.2.

Running code on Macbook Pro with macOS Sierra v10.12.2 from XCode 8.2.1 (Swift3).


Tried both with WiFi, BT, and every combination in between...


Just added:

<key>NSAppTransportSecurity</key>

<dict>

<key>NSAllowsArbitraryLoads</key>

<true/>

<key>NSTemporaryExceptionRequiresForwardSecrecy</key>

<false/>

</dict>


Did not helped much... Still getting in the console (just on the iOS 10.2 device, though...):

2017-02-06 15:17:37.858063 Advertiser[1149:316236] [ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (1724768204)

2017-02-06 15:17:39.727633 Advertiser[1149:316295] [ViceroyTrace] [ICE][ERROR] Send BINDING_REQUEST failed(C01A0041).

2017-02-06 15:17:48.110301 Advertiser[1149:316267] [GCKSession] Not in connected state, so giving up for participant [66CDDFCC] on channel [0].

Each message few times...


(Advertiser is the name of the app)

Did you find a solution to this problem? I also tried to use the MPC framework but it seems really unstable and I get errors like yours. Most of the time it only works the first time the app is launched after being built to a device, or under certain combinations of bluetooth, wifi or mobile data.

I have observed a successful MPC connection over bluetooth with both devices running iOS 10.3.2. That seems to indicate that the MPC/bluetooth problem may have been fixed.

I had the same problem: "[ViceroyTrace] [ICE][ERROR] Send BINDING_REQUEST failed(C01A0041)." (even with the latest iOS 10.3.3)


Here's how i fixed it:


  • Set the session encryptionPreference to .optional
  • Implement the session delegate didReceiveCertificate with this code:

    certificateHandler(true)


Now the connection changed from .connecting to .connected


Hope it helps you 🙂

We are having this problem again on iOS15 running over Bluetooth. Session connects successfully over Wifi but never gets to connected over Bluetooth. Over bluetooth it gets to connecting state receiving the invite in didReceiveInvitationFromPeer which we handle but then never gets any further and eventually timesout. We are using the apple sample Streaming an AR Experience app ( https://developer.apple.com/documentation/arkit/streaming_an_ar_experience )

Is anyone else able to get this working over Bluetooth on iOS15?