您的位置:首页 > 理论基础 > 计算机网络

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

2012-04-12 13:25 441 查看
在arc开发环境下用ASIHttpRequest,采用block的方式回调http响应时,会出现block will be retained by the captured object的warning.

解决方法是在声明前加__unsafe_unretained

如:

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


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

reference:http://article.ityran.com/archives/1221
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  service ios object url web