简体   繁体   中英

Why does a message send cause a retain cycle warning in ARC, but a property set does not?

[self.foo setBlock:^{
    [self doSomething]; // causes warning
}];

versus

[self.foo setBlock:^{
    self.bar = baz;     // does not cause warning
}];

The warning being "Capturing self strongly in this block is likely to lead to a retain cycle."

Don't both lead to a strong reference?

This is a compiler bug and you should file a bug report with Apple.

Both are the same, ab = c is just a different way for writing [a setB: c] . If the compiler handles one differently from the other this is a bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM