I try to use the Multipeer Connectivity framework, but I get a failure when trying to instantiate MCNeaarbyServiceBrowser using serviceType.
Below is the code:
private func setUpSession() { self.session = MCSession(peer: self.peerId); self.session!.delegate = self; self.browser = MCNearbyServiceBrowser(peer: self.peerId, serviceType: "stc-classroom-vik"); self.browser!.delegate = self; self.advertiser = MCNearbyServiceAdvertiser(peer: self.peerId, discoveryInfo: nil, serviceType: "stc-classroom-vik"); self.advertiser!.delegate = self; }
and this is the error / error I get:
2014-08-15 12:24:42.689 Xavier[614:254319] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid serviceType passed to MCNearbyServiceBrowser'
I would really appreciate any help.
ios ios8 swift multipeer-connectivity
Vik singh
source share