5

When the MCBrowserViewController is invoked

-[MCBrowserViewController advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance

error message is thrown.

when MCAdvertiserAssistant tries starts advertising

-[MCAdvertiserAssistant advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance

error message is thrown.

Struck and unable to proceed. My business depends on MultipeerConnectivity framework.

Any help will be greatly appreciated.

Rajesh
  • 10,318
  • 16
  • 44
  • 64

2 Answers2

8
let assistant = MCAdvertiserAssistant(serviceType: "tictactoe", discoveryInfo: nil, session: session)
let browser = MCBrowserViewController(serviceType: "tictactoe", session: session)

Insert in the info.plist the following fields:

  1. Privacy - Local Network Usage Description
  2. Bonjour services with the following initialisation: _tictactoe._tcp and _tictactoe._udp

enter image description here enter image description here

hamzaozturk
  • 453
  • 1
  • 5
  • 12
2

i did face some issues implementing MultipeerConnectivity too. After some research found a fix.. what i did was

  1. i followed https://www.hackingwithswift.com/example-code/networking/how-to-create-a-peer-to-peer-network-using-the-multipeer-connectivity-framework this.
  2. added Bonjour services (value- _*serviceType*._tcp) and Privacy - Local Network Usage Description in Info.plist.
  3. removed SceneDelegate related stuff as in Opt out of UISceneDelegate/SwiftUI on iOS

clean and build.

Note:i am working with Xcode12 and iOS14.

ghostK9
  • 51
  • 3