开发者

OK to assign one NSObject as the delegate of multiple ASIHTTPRequests?

Is it OK to assign one NSObject as the delegate of multiple, asynchronous ASIHTTPRequests?

My concern is that two or more requests will call the same callback method on the delegate at the same time.

I checked that ASIHTTPRequest calls the delegate callbacks on the main thread, just as NSURLConnection do开发者_如何学JAVAes. So, it's OK, right?


Yes, this is fine, normal, and part of the design of delegates.


Yes, this is a perfectly normal thing to do. Properly designed APIs should pass the calling object as a parameter of any delegate methods. This way, an object acting as a delegate can (if necessary) distinguish its delegate responsibilities by delegating object instance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜