ASIHttpRequest block在ARC下使用时出错circle retain的问题及解决方法

在arc开发环境下用ASIHttpRequest,采用block的方式回调http响应时,会出现block will be retained by the captured object的warning.

解决方法是在声明前加__unsafe_unretained


如:

  1. NSURL *url = [NSURL URLWithString:WEB_SERVICE];  
  2. __unsafe_unretained __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];  

这样可以同时支持iOS4,因为iOS4不能用__weak.


参考地址:http://www.cocoachina.com/bbs/simple/?t96824.html

http://blog.csdn.net/favormm/article/details/7453376

你可能感兴趣的:(ios,ASIHTTPRequest,block,arc,循环调用)