Hope all is well.
Please, I have an application that shares photos between neighboring devices using the multiplier connection infrastructure.
I have a problem every time I click connect, when I exchange a session and the browser that it connects to me, but I get this message, and the photos sent fail below the error message:
[ERROR] ProcessEvent:1199 Send BINDING_REQUEST failed(C01A0000).
[GCKSession] Not in connected state, so giving up for participant [7A5C490D] on channel [0].
[GCKSession] Not in connected state, so giving up for participant [7A5C490D] on channel [1].
[ERROR] ICEStopConnectivityCheck:2688 ICEStopConnectivityCheck() found no ICE check with call id (2052868365)
[GCKSession] Not in connected state, so giving up for participant [7A5C490D] on channel [2].
[ERROR] ICEStopConnectivityCheck:2688 ICEStopConnectivityCheck() found no ICE check with call id (2052868365)
The code I used below:
override func viewDidLoad() {
super.viewDidLoad()
collectionView.delegate = self
collectionView.dataSource = self
peerID = MCPeerID(displayName: UIDevice.current.name)
mcSession = MCSession(peer: peerID, securityIdentity: nil, encryptionPreference: .none)
mcSession.delegate = self
}
@IBAction func showAlertForShare(_ sender: UIBarButtonItem) {
let alertController = UIAlertController(title: "Share Photos", message: "Do You Want Share The Photo With Other User?", preferredStyle: .actionSheet)
let alertHostSession = UIAlertAction(title: "Host A Session", style: .default) { (alertAction) in
self.mcAdvertiserAssistant = MCAdvertiserAssistant(serviceType: "hws-desertqwert", discoveryInfo: nil, session: self.mcSession)
self.mcAdvertiserAssistant.start()
}
let alertJoinSession = UIAlertAction(title: "Join A Session", style: .default) { (alertAction) in
self.mcbrowserViewController = MCBrowserViewController(serviceType: "hws-desertqwert", session: self.mcSession)
self.mcbrowserViewController.delegate = self
self.present(self.mcbrowserViewController, animated: true, completion: nil)
}
let alertCancel = UIAlertAction(title: "Cancel", style: .cancel) { (alertAction) in
alertController.dismiss(animated: true, completion: nil)
}
alertController.addAction(alertHostSession)
alertController.addAction(alertJoinSession)
alertController.addAction(alertCancel)
self.present(alertController, animated: true, completion: nil)
}
func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState) {
switch state {
case .connected:
print("Connected: \(peerID)")
case .connecting:
print("Connecting: \(peerID)")
case .notConnected:
print("Not Connecting: \(peerID)")
}
}
func session(_ session: MCSession, didReceive data: Data, fromPeer peerID: MCPeerID) {
print(data)
if let getImage = UIImage(data: data) {
print(self.mcSession.connectedPeers.count)
self.arrayOfImages.append(getImage)
DispatchQueue.main.async {
self.collectionView.reloadData()
}
}
}
func session(_ session: MCSession, didReceive stream: InputStream, withName streamName: String, fromPeer peerID: MCPeerID) {
}
func session(_ session: MCSession, didStartReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, with progress: Progress) {
}
func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL?, withError error: Error?) {
}
func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
self.dismiss(animated: true, completion: nil)
}
func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) {
self.dismiss(animated: true, completion: nil)
}
please can anyone fix this problem?
Many thanks