上传背景图片模式 [英] Upload images on background mode
问题描述
我有我想用来上传图片到服务器的Web服务,通过wsdl2objc生成的Web服务代理类,它使用的NSOperation进行SOAP调用。在上传过程中我preSS home键和应用程序进入后台模式,会在这种情况下,什么假设?将上载过程终止?或进程将反正完成。
I have web service which i want to use to upload image to the server, web service proxy classes generated by wsdl2objc it uses NSOperation to perform soap calls. Suppose during the upload process i press the home button and application enters the background mode, what will be in that case? will the upload process terminate? or process will complete anyway.
推荐答案
默认情况下,操作系统将冻结您的应用程序在后台运行。当发生这种情况时,远程服务器可能会关闭一段时间后连接,因为您的应用程序没有响应。
By default, the OS will freeze your app in the background. When that happens, the remote server will probably close the connection after a while because your app doesn't respond.
您可以避免通过包装在一个后台任务上传code(使用方法 beginBackgroundTaskWithExpirationHandler:
和 endBackgroundTask:
),在这种情况下,操作系统将让在后台您的应用程序运行的另一个10分钟,以完成其工作。
You can avoid that by wrapping your upload code in a background task (with the methods beginBackgroundTaskWithExpirationHandler:
and endBackgroundTask:
), in which case the OS will let your app run in the background for another 10 minutes to finish its work.
这篇关于上传背景图片模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!