Search code examples
iosswiftmultipeer-connectivity

Multipeer Connectivity in background mode


I have implemented an iOS app that uses MPC to send data to an OS X app. After the MPC session is established, data is being transferred with no issues. However, when the iOS app goes into background mode, after a while it looks like the session is getting disconnected.

Please note the following facts:

  1. The iOS app is set to be working on background as it also doing some BLE tasks, so I know for sure that the iOS app is running with no issues even when in background mode (I made sure it does not go into suspended mode at any time).
  2. I am aware of the Apple docs that states that MPC will get close once app goes into background mode.

If the app moves into the background, the framework stops advertising and browsing and disconnects any open sessions. Upon returning to the foreground, the framework automatically resumes advertising and browsing, but the developer must reestablish any closed sessions.

My question is, is there any workaround that will keep my MPC alive even when app is in background mode?

UPDATE: I could not find a workaround for that. I ended up using pure BLE.


Solution

  • No, unfortunately there is no workaround to keep MPC sessions alive while the app is in background mode.