开发者

Force iPad to stay awake while app is running a process

开发者 https://www.devze.com 2023-03-31 14:54 出处:网络
When my app starts for the first ti开发者_JS百科me, if the iPad goes into sleep mode the app doesnt run properly. Is there a way to force the iPad to stay awake during this process? While you can disa

When my app starts for the first ti开发者_JS百科me, if the iPad goes into sleep mode the app doesnt run properly. Is there a way to force the iPad to stay awake during this process?


While you can disable the sleep mode programmatically, your correct approach here is to fix the bug.

You cannot prevent the user from switching the device off manually anyway.


You shouldn't expected user to do something (wait) to make you app run properly. From you reply on @Eiko you have to downloaded something on the server, in this case could you delayed the download until its really need and prompt user for some text before your download, with this approach user will get some idea of what is he waiting. This is all I can think of with your information.


You might want to consider using something like the ASI library to make downloading the file easier. http://allseeing-i.com/ASIHTTPRequest/

Is the problem that you are in the middle of a database transaction and the download is a key piece of the transaction? If so you should defer saving the database commands until you are ready to commit OR even better, download the file before making DB changes.

0

精彩评论

暂无评论...
验证码 换一张
取 消