WiFi disconnects after a period of inactivity

My iPhone application establishes a TCP connection via Wi-Fi to a remote server. However, if there is no user activity for a certain time, the device closes Wi-Fi and disconnects the connection. Can this be prevented? I need a constant connection while the application is running. Setting setIdleTimerDisabled: YES does not help - it prevents the screen from exiting, but Wi-Fi is closed.

Do you know if this is possible and how to achieve it?

+3
source share
1 answer

Check this URL: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW59

Table 1-3 Important Keys in the Info.plist File

UIRequiresPersistentWiFi:

A logical value that notifies the system that the application is using a Wi-Fi network for communication. Applications that use Wi-Fi for any period of time must set this key to true; otherwise, after 30 minutes, the device will turn off Wi-Fi connections to save energy. Setting this flag also allows the system to know that it should display a network selection dialog when Wi-Fi is available but not currently in use. The default value is false.

+6

Source: https://habr.com/ru/post/1706598/


All Articles