Background Modes (iOS)
iOS aggressively manages background networking. Design for fast reconnection and deliberate wake mechanisms.
Reality check
Persistent background P2P connectivity is not guaranteed on iOS. The best practice is to reconnect quickly when the app is foregrounded or woken by notifications.
Enable Background Modes
- Xcode → Target → Signing & Capabilities
- Add Background Modes
- Enable the modes required for your product (e.g. Remote notifications)
Recommended strategy
- Disconnect gracefully when backgrounded unless you have an explicit wake plan.
- On resume, connect with backoff and restore subscriptions/state.
- Use Push Notifications to wake for critical events.