tags:

views:

140

answers:

1

I'm having trouble keeping wifi from disconnecting after 30 mins in an iphone app that needs to function when locked by the user.

The app normally does not sleep, but if the user so chooses they may lock the display. I'm adding a new feature to the app that sends data out over the network at 1 second intervals. prior to this there has been no network requirement for the app, and it has functioned as desired (music, timer-based processes) while user-locked.

The answer seemed to be here:
http://stackoverflow.com/questions/3138923/wifi-connection-doesnt-stay-alive-when-asleep-with-ios4

But adding UIRequiresPersistentWifi boolean to info.plist doesn't keep it from timing out the wifi (i'm testing on Touch, iOS4.02) after 30 mins, even while the app is busy sending data out over the connetion. Maybe this only applies if the display sleeps itself, rather than user locks?

Related, I think there is no way to "stir" the display at any interval? User pressing the home button is sufficient to bring back the wifi; unlocking is not necessary.

Also, I've read on the interwebs that it was stated in a WWDC that UIRequiresPersistentWifi applies to keeping alive 3G as well. Can anyone verify?

thanks

A: 

Your app may be getting suspended by the OS after a long enough period of user inactivity.

Under iOS 4.x there are certain types of apps that aren't suspended when the display is locked (music player, VOIP, etc.) Apps that register as a VOIP type app might be allowed to keep a persistant network connection over a longer period. However Apple may require that an app actually provide some VOIP functionality in order to register for that type in any app submitted for review.

hotpaw2
Adding an array named UIBackgroundModes to info.plist, with a member "voip" did not keep the wifi going. However I think it shouldn't have anyway. To clarify, my app is not in the background when the 30min timeout occurs. It is the active app, with the display locked by the user.
ransomweaver
Also, the app is functioning normally when locked, except for the disappearing network. It also stores data using core data, and the data for the period after wifi sleeps is recorded properly. Audio aspects of the app execute properly.
ransomweaver