(74) How to make the socket run in the background before iOS8

Source: Internet
Author: User

For applications that use socket communication, it is often desirable for the app to be in the background for network communication, which is allowed by default in IOS8 and later versions, and the socket can be run directly in the background, but not for versions prior to iOS8. Two-step setup is required to allow the socket to run in the background.

Here, for example, in the case of XMPP sockets, the following two steps are required in order to send push notifications after receiving a message in the background:

① Open Info.plist, add the following key-value pairs:

Required Background modes = APP provides Voice over IP services

② configuration Xmppstream The Enablebackgroundingonsocket property is yes:

_xmppstream.enablebackgroundingonsocket = YES;

It should be noted that in the IOS7 simulator, this setup is still unable to implement the socket background operation, this is the emulator bug, on the real machine can be implemented.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

(74) How to make the socket run in the background before iOS8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.