Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in
read-only mode
.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
I have an app that communicates with a server using a QSslSocket. On Android, Linux, Windows and macOS, putting the device to sleep keeps the socket connected. However, on iOS, whenever the screen is put to sleep using the sleep button, the socket is disconnected. Does anyone know how to prevent this from happening?
I've been looking through all the key/values in the info.plist, hoping to find a setting that would change this behavior but so far I have had little luck. I did notice the when I set UIApplicationExitsOnSuspend to true, that then the socket would be kept open when pressing the sleep button, exactly like what I want. However, then pressing the home button completely exits the app instead of putting it in the background, which is undesired behavior for me.
I've also looked at UIBackgroundModes and UIRequiresPersistentWiFi, but these also didn't help me.
Does anyone have a solution to this, or am I really going to have to reestablish the socket connection every time the device wakes up?
If you need more information or want to see some example code, don't hesitate to ask and I'll see what I can do.
@stcorp
said in
iOS network socket being closed on sleep
:
I have an app that communicates with a server using a QSslSocket. On Android, Linux, Windows and macOS, putting the device to sleep keeps the socket connected. However, on
iOS
, whenever the screen is put to sleep using the sleep button, the socket is disconnected. Does anyone know how to prevent this from happening?
I've been looking through all the key/values in the info.plist, hoping to find a setting that would change this behavior but so far I have had little luck. I did notice the when I set UIApplicationExitsOnSuspend to true, that then the socket would be kept open when pressing the sleep button, exactly like what I want. However, then pressing the home button completely exits the app instead of putting it in the background, which is undesired behavior for me.
I've also looked at UIBackgroundModes and UIRequiresPersistentWiFi, but these also didn't help me.
Does anyone have a solution to this, or am I really going to have to reestablish the socket connection every time the device wakes up?
If you need more information or want to see some example code, don't hesitate to ask and I'll see what I can do.
Also, try to follow link instructions
http://developer.apple.com/library/ios/#technotes/tn2277/_index.html
. It may help you to resolve your issue.