0

我需要取消我的请求。我怎样才能做到这一点。我试图创建属性并将其用作分配给ASIHTTPRequest *request. 但是当我打电话时,[request cancel]我可以使用床位,因为请求保留计数为 0(由于[ASIHTTPRequest requestWithURL:url]返回自动释放对象)。我无法创建强大的属性,我收到以下警告:

Capturing 'request' strongly in this block is likely to lead to a retain cycle

这是我下面的代码:

__unsafe_unretained __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setCompletionBlock:^{       
    NSString *response = [request responseString];  
}];
[request setFailedBlock:^{          
}];
[request startAsynchronous];    
4

0 回答 0