I'm doing a P2P VoIP application using GCDAsyncSocket, GCDAsyncUdpSocket and NSNetService to find other devices with the application on the network. I have a TCP socket to transfer user data and negotiate the UDP connection.
I need to keep the NSNetService service in publishing Bonjour while the App is in the background and keep an open socket for receiving requests from other devices.
Pressing the HOME button of the iPhone, the socket does not disconnect but does not respond and the data is sent the application only when the app is reopened. By blocking the screen, the socket is closed.
The NSNetService to publish when the application is closed.
I activated the options of background VoIP App, Audio, etc.
I used
[ asyncSocket performBlock : ^ {
[ asyncSocket enableBackgroundingOnSocket ];
}];
Someone knows how to keep the Socket and the NSNetService working when the iPhone is locked?