相关疑难解决方法(0)

修复警告"在此块中强烈捕获[某个对象]可能会导致启用ARC的代码中的保留周期"

在启用ARC的代码中,如何在使用基于块的API时修复有关潜在保留周期的警告?

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

由这段代码生成:

ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:...

[request setCompletionBlock:^{
    NSDictionary *jsonDictionary = [[CJSONDeserializer deserializer] deserialize:request.rawResponseData error:nil];
    // ...
    }];
Run Code Online (Sandbox Code Playgroud)

警告与request块内对象的使用相关联.

cocoa cocoa-touch retain asihttprequest automatic-ref-counting

140
推荐指数
4
解决办法
5万
查看次数

ARC - __unsafe_unretained的含义?

只是想确保我做对了:

  1. 我需要__unsafe_unretain我不拥有的物品吗?
  2. 如果一个对象是__unsafe_unretained我需要assign@property?这是否意味着不保留对象,只是引用我指定的对象?
  3. 除了代表,我什么时候才能使用它?
  4. 这是ARC的事情还是之前使用过的?

macos objective-c ios xcode4 automatic-ref-counting

76
推荐指数
1
解决办法
4万
查看次数