Dear all,
I ask you for some help after receiving an error while I was executing the following piece of code.
I received the following runtime error:
The code works well on the simulator, but no in the physical device.
Thank you in advance,
Mirko Franco
I ask you for some help after receiving an error while I was executing the following piece of code.
Code Block session = MCSession(peer: MCPeerID(displayName: UIDevice.current.name), securityIdentity: nil, encryptionPreference: .optional ) session?.delegate = self assistant = MCAdvertiserAssistant(serviceType: "PlayWithEyes", discoveryInfo: nil, session: session!) browser = MCBrowserViewController(serviceType: "PlayWithEyes", session: session! ) browser?.delegate = self assistant!.start() browser?.modalPresentationStyle = .formSheet present(browser!, animated: true, completion: nil)
I received the following runtime error:
Has anyone of you some ideas?Exception NSException * "-[MCAdvertiserAssistant advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance 0x280130ee0" 0x0000000282461e00
The code works well on the simulator, but no in the physical device.
Thank you in advance,
Mirko Franco
I have just found a solution.
Given this code example:
It is sufficient to insert in the info.plist the following fields:
1) Privacy - Local Network Usage Description
2) Bonjour services with the following initialisation: _service._tcp and _service._udp
Given this code example:
Code Block assistant = MCAdvertiserAssistant(serviceType: "service", discoveryInfo: nil, session: session!) browser = MCBrowserViewController(serviceType: "service", session: session! )
It is sufficient to insert in the info.plist the following fields:
1) Privacy - Local Network Usage Description
2) Bonjour services with the following initialisation: _service._tcp and _service._udp