NSURLSession:后台上传然后调用服务api [英] NSURLSession: background upload and then call a service api

查看:65
本文介绍了NSURLSession:后台上传然后调用服务api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用新的ios7后台传输api将一些照片上传到服务器。它现在发生的是
1)我们将字节上传到s3
2)调用服务api来完成上传

I was trying to use the new ios7 background transfer api to upload some photos to a server. what it happened now is 1) we upload the bytes to s3 2) call a service api to 'complete' the upload

我看了在这个文档和似乎背景NSURLSession不支持'数据'任务。这是否意味着我在实际上传完成后无法在后台执行第2步?

i looked at this doc and it seems background NSURLSession doesn't support 'data' task. does that mean i can't do the step 2 in background after the actual upload is done?

推荐答案

如果你想要更简单解决方案,而不是重新利用 NSURLSessionDownloadTask 进行已完成的API调用,您可以在回调期间快速进行快速http调用:

If you want a simpler solution than repurposing NSURLSessionDownloadTask for your "completed" API call, you can round trip a quick http call during the callback in:

-URLSession:task:didCompleteWithError:

这篇关于NSURLSession:后台上传然后调用服务api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆