To starting peer to peer connection between iOS devices;
I was using this code;
func setUpSessionForMaster() {
if advertiser != nil {
advertiser = nil
}
localPeerID = MCPeerID(displayName: peerName )
if localSession != nil {self.localSession!.disconnect()}
localSession = MCSession(peer: localPeerID!);
localSession!.delegate = self;
browser = MCNearbyServiceBrowser(peer: localPeerID!,
serviceType: serviceName);
browser!.delegate = self;
// starts browser and advetiser for peer to peer services
browser!.startBrowsingForPeers()
}
but following functions does not fire anymore;
func browser(_ browser: MCNearbyServiceBrowser, didUpdateState state: MCSessionState) {
print("Browser did update state: \(state.rawValue)")
}
func browser(_ browser: MCNearbyServiceBrowser, foundPeer peerID: MCPeerID, withDiscoveryInfo info: [String: String]?) {
print("Browser found peer: \(peerID.displayName)")
}
Feels like required permissions has been changed by Apple
I set two setup in info.plist for p2p connection;
1- Bonjour services
appName.upd
appName.tcp
2- Privacy – Local Network Usage Description