Download in background in iPhone

落花浮王杯 提交于 2020-01-09 11:18:29

问题


Is it possible to download a file while the app is in background in iPhone 4?


回答1:


Under iOS 4.x, you can use request some background time using UIApplication beginBackgroundTaskWithExpirationHandler: and perhaps continue a file download for a limited period of time.

See Apple's document on "multitasking" background execution for details.




回答2:


Yes, it is.

It's supported in ASIHTTPRequest as of v1.8:

http://allseeing-i.com/ASIHTTPRequest/How-to-use#background_downloads_ios

(There was also an experimental branch of v1.7 with it at http://github.com/pokeb/asi-http-request/commits/backgroundtask but this appears not to exist anymore.)

It's also supported in AFNetworking, see Does AFNetworking have backgrounding support?



来源:https://stackoverflow.com/questions/3612963/download-in-background-in-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!