FBRequestDelegate didReceiveResponse 如何找出此响应的请求
我正在使用 facebook 最新的 iphone sdk,我从应用程序中的不同位置向 facebook 发出多个请求。对于所有这些 didReceiveResponse 和 didLoad 方法都被调用,很难从 didLoad 方法中找出这个响应是什么请求,所以我想知道 didReceiveResponse 是否可以提供帮助,我可以在这个方法中检索一些信息来告诉我什么是我已得到答复的请求。
I am using facebook latest iphone sdk, I am making multiple request to facebook from different places in my app. For all of them didReceiveResponse and didLoad methods get called, it is very difficult to find out from didLoad method that for what request this response was so I am wondering if didReceiveResponse can help, can i retrieve some information in this method which will tell me what was the request for which I have got the response.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我的做法与 Ziminji 的做法几乎相同,但在 didLoad 方法中:
所以基本上你只需要检查你发送请求的 url,你还可以检查该请求的参数。然后您就可以将其中一个与另一个区分开来。
The way I do it is pretty much the same way Ziminji does it, but in didLoad method:
So basically you need only to check the url you sent the request to, and you can also check the parameters for that request. Then you can differentiate one from another.
我在这里所做的就是检查响应中的某些唯一属性并将其与请求相关联,我知道这不是最好的方法,但这是我迄今为止发现的,请告诉我如果任何人都在做不同的事情
All I am doing here is I am checking for some unique attribute in the response and relating it to the request, I know this is not the best way to do is, but this is what I have found so far, please let me know if any one is doing it any different
您可以尝试如下操作:
You could try something like the following:
如果您在创建请求对象时将请求对象保留为请求委托的属性,则可以检查它是否与委托方法调用匹配。例如:
If you retain the request object as a property of your request delegate when you create it, you can check to see if it matches on the delegate method calls. For example: