Multipeer Framework Unusable Due to Invitation Bugs

I would like to get an idea whether anyone is actually using Multipeer in a recent production iOS app.

I’ve burned several days worth of my client’s money getting Multipeer set up, but the invitation system just isn’t anywhere near reliable enough to ship. The use cases is trivial, it’s just a chat room.

I assumed I was doing something wrong, so I went looking for examples on Github and my code looked much the same as everyone else’s. Eventually I found the MultipeerGroupChat sample app (https://developer.apple.com/library/archive/samplecode/MultipeerGroupChat/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013691), and after trying it on 3 devices I confirmed that the invite flow is broken for it too.

Although the sample app uses Apple’s UI helpers (MCBrowserViewController and MCAdvertiserAssistant), and my app has a custom UI and uses the lower-level MCNearbyServiceAdvertiser and MCNearbyServiceBrowser, I can see the underlying issues are the same.

Here’s one example which fails reliably for me:
  • Boot the sample on 3 devices

  • Open the browser on one device and invite the others

  • All 3 are connected and can send messages successfully

  • Go home/lock one device and wait such that the others show it as disconnected; or you can force quit it

  • Bring the app back up on that device

  • Now, try and reconnect it to the other two

  • No matter which device(s) you try to send the invites from (either the one that returned, or one of the others), you’ll get in a mess

  • The invite is (usually) delivered, but then one or both devices involved will get stuck in the 'connecting' state

  • There’s no way out, except to disconnect the session and start again

I genuinely want to know whether this framework is in use in real apps and there are workarounds to the reliability issues, or whether it’s just something with a bunch of tutorials online that nobody really uses.

Replies

Don't use it. It's monumentally screwed up. I've seen massive problems with > 4 devices. It's a massive waste of time.
@azav, what do you suggest as an alternative for > 4 devices?
I'm afraid that I don't have an answer.