Search code examples
iosswift2xmppopenfirexcode7.2

How to keep XMPP connection alive in the IOS App when app in background?


I have create basic chat app with XMPP Server in swift 2 (from this tutorial: http://shubhank101.github.io/iOSAndroidChaosOverFlow/2016/08/Chat-Application-Using-XMPP-Swift-Tutorial). My app is working good. but when my app went into background then my app unable to receive any message from XMPP server. i think this is because of XMPP connection break while entering the app in background.

i have tried to found the help on google for the same but nothing found related to Swift 2

Please help me. if some one put some sample code that would very helpfull for me because i m new to IOS development.


Solution

  • Third-party apps on the iOS are not allowed to keep network connection in background. See Apple guidelines how to avoid background networking.