I'm trying to create an app similar to FireChat where users are automatically connected to a Multipeer Connectivity session without sending or receiving invitations to connect.
All the tutorials i have seen make use of the MCBrowserViewController. It must be possible to join a session without having to select a peer to connect and send and accept a request to connect if Firechat soes it.
Does anyone know how to do this?
Thanks
Instead of using an MCBroswerViewController, you can use MCNearbyServiceBrowser. It will then call a delegate method:
- (void)browser:(MCNearbyServiceBrowser *)browser foundPeer:(MCPeerID *)peerID withDiscoveryInfo:(NSDictionary *)info;
Then you can automatically send an invitation with something like:
[browser invitePeer:peerID
toSession:self.session
withContext:nil
timeout:10];
However, in doing this, I've ran into tons of other problems. So far it seems:
I'm actually working on an open source library right now to try and do exactly what you're asking for: Connect devices without any invitations or browser necessary (no UI).
Here it is: https://github.com/plivesey/PLPartyTime
However, it is not working yet. I haven't fully solved both issues above, but if you want to check out the code and see what you can work out, go for it. Please let me know of any progress you make though. This framework is frustrating to deal with...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With