[英]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." 警告是“在这个区块中强烈捕捉self
可能会导致保留周期。”
Don't both lead to a strong reference? 两者都不会导致强烈的参考?
This is a compiler bug and you should file a bug report with Apple. 这是一个编译器错误,您应该向Apple提交错误报告。
Both are the same, ab = c
is just a different way for writing [a setB: c]
. 两者都是相同的, ab = c
只是写[a setB: c]
的另一种方式。 If the compiler handles one differently from the other this is a bug. 如果编译器以不同的方式处理一个,则这是一个错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.