Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 : Multipeer connectivity - Multiple Sessions?

I'm trying to create an via iOS7 multipeer connnectivity where:

  1. Browser1 can see Advertiser1 and Advertiser2

  2. Browser1 sends an invite to Advertiser1 and is approved

  3. Browser1 sends an invite to Advertiser2 and is approved

  4. Browser1 can send messages to Advertiser1 and Advertiser2 separately

All the examples I've seen show the creation of a single MCSession when the MCNearbyServiceAdvertiser and MCNearbyServiceBrowser are initialized.

My question is: it it possible to have an array to maintain multiple sessions between groups of devices? If so, where should I be creating the new MCSession objects?

like image 510
dpigera Avatar asked Nov 05 '25 08:11

dpigera


1 Answers

The Apple sample application for the MCMultipeerConnectivity framework contains the use-case you describe.

They create a wrapper class to handle the MCSession, and each MCSession maintains an array of connected MCPeerIDs.

Source: https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html

like image 192
Tim Avatar answered Nov 08 '25 12:11

Tim