Multipeer Connectivity support

Greetings.


I have an app today that uses multipeer connectivity extensively. Currently, when the user switches away from the app, MPC disconnects the session(s) - this is by design apparently (per other feedback). I'd like to hear if anyone has experimented with iOS9 multitasking / multipeer and whether MPC sessions can stay alive?


Thanks

Post not yet marked as solved Up vote post of 300Baud Down vote post of 300Baud
2.9k views

Replies

Reply to 300Baud

Nice user name (-:

Multipeer Connectivity does not support operating in the background; it's really that simply. You may be able to get some things to work, but I recommend that you not go down that path because, when you do unsupported things, you run the risk of future changes breaking your code.

The networking stack does, in general, support operating in the background. Where things start to go wrong is if your app gets suspended in the background. Technote 2277 Networking and Multitasking has the details. So, if your already have a way to prevent your app from suspended—for example, it's an audio app that's playing music—you can use other networking APIs in the background quite successfully.

OTOH, if you can't avoid suspending in the background, you will have to look at APIs that let you make progress while you're suspended; that typically means using NSURLSession background session support, possibly in conjunction with UIApplication's background fetch support.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Building a remote control type of app would I be allowed to keep the connection between the iPhone and the Mac? Is there any other way to have a uninterrupted communication when app in the background that would build on bluetooth rather than wifi only?

Building a remote control type of app would I be allowed to keep the connection between the iPhone and the Mac?

Probably not.

Is there any other way to have a uninterrupted communication when app in the background that would build on bluetooth rather than wifi only?

That depends on whether you mean Bluetooth networking or Bluetooth LE.
  • Peer-to-peer Bluetooth networking is no longer supported on our platforms, so that’s a dead end.

  • In contrast, Core Bluetooth, the API for Bluetooth, supports a couple of useful background modes. I’m not the right person to held you with that. I recommend that you create a new thread with the details. Make sure you tag it with Core Bluetooth.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

Hello,

I was wondering if you found a fix for this? I'm having the same issue from 7 years ago :)

Thanks