I wonder if this Multipeer Connectivity framework is ready for use in the real world, given all the bugs that have been encountered by the community. I think I'm setting it up right, but all the other sample projects I've tried encounter similar issues.
The problem I'm having may be tied to some issue inherent to Bonjour or something, I can't figure it out, but basically the problem is as follows:
- I have an active
MCSession
with a number of peers. - Now, if a device is in a session, and then force quits out, that "Peer" stays connected for an indefinite amount of time.
- There's nothing I can do to force that user out, even though the
browser:lostPeer:
method is called for that peer and is no longer even showing up in the browser as "Nearby". - The
session:peer:didChangeState:
method is not called for that peer. - When that peer that force quitted comes back to the app, they are "Found" again by the
browser:foundPeer:withDiscoveryInfo:
but still also exist in thesession.connectedPeers
NSArray. Obviously they don't receive any data or updates about the session still and are not actually connected. - The only thing that seems to work to register that original peer as
MCSessionStateNotConnected
to the session is by reconnecting that peer to the original session. Then there is a duplicate call tosession:peer:didChangeState:
where the new instance of the peerID isMCSessionStateConnected
and shortly after the old instance of the peerID calls withMCSessionStateNotConnected
.
The sample chat application demonstrates this issue well: https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html
Since there doesn't seem to be any way to manually force remove a peer from the session, what should I do? Should I try and rebuild the session somehow?
This Framework seems like a bit of a mess, but I'm trying to reserve judgement!