iOS Backgrounding & XMPPFramework

℡╲_俬逩灬. 提交于 2019-12-11 09:47:11

问题


So I've created a simple XMPP app, but it appears I can't have background processing unless the app is one of the designated categories listed here.

I just want to keep the socket open and display a notification on message received if the app isn't in the foreground.

I've found it a little difficult to find out good information on iOS backgrounding, it appears a lot of apps out there manage to do it some how, but the documentation seems a lot more restrictive.

Is it possible to run a chat client like this in the background for extended periods of time? Something similar to Androids Service lifecycle?


回答1:


When your app goes in background you (the client) close the connection with the xmpp server. When your app comes back into foreground you reopen the connection. If your server need to send messages to your client, it must use push notifications. When the client receives the notification CAN (it depends on the user action) can back to foreground.




回答2:


It's not so easy like in Android. To preserve battery, apple has implemented a limit of 10 Minutes.

There is only 10 minutes, no backgrounding or unlimited backgrounding. So in your app, you have to get unlimited. I don't know if it is so easy, when your app doesn't exactly fit into the given list.



来源:https://stackoverflow.com/questions/10229723/ios-backgrounding-xmppframework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!