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:
- -(void)advertiser:(MCNearbyServiceAdvertiser *)advertiser didReceiveInvitationFromPeer:(MCPeerID *)peerID withContext:(NSData *)context invitationHandler:(void (^)(BOOL, MCSession *))invitationHandler
- {
- if (_serverState == ServerStateAcceptingConnections && [self connectedClientCount] < self.maxClients)
- {
- NSLog(@"MatchmakingServer: Connection accepted from peer %@", peerID);
- invitationHandler (true, _session);
- }
- else
- {
- invitationHandler (false, _session);
- }
- }
- -(void)session:(MCSession *)session didReceiveCertificate:(NSArray *)certificate fromPeer:(MCPeerID *)peerID certificateHandler:(void (^)(BOOL))certificateHandler
- {
- certificateHandler (true);
- }
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.