【发布时间】:2016-04-26 10:22:04
【问题描述】:
在我的应用中,当我们点击登录按钮时,我们必须进行 3 次服务器调用。
1) will make a server call to get an OAuth token for user credentials
2) with the token from (1) we will get user privileges
3) with the token from (1) and with the valid privilege from (2) we will get the data to be displayed on the page after login in a tableview.
我对为此采取的方法感到困惑。使用 operationqueue 添加依赖项或使用 NSURLSession 任务是一个好方法吗?
根据对此的堆栈溢出解决方案之一 - Best practices for making a queue of NSURLSessionTasks , NSURLSession 没有任何关于排序请求的逻辑,即使将每个主机的最大连接数设置为 1,它也只会调用先完成的任何内容的 completionBlock
如果有其他更好的方法,请告诉我..
【问题讨论】:
标签: ios swift nsoperationqueue nsurlsessiondatatask