I use an ivar in a reactive cocoa's block, set weakify(self) and strongify(self) to break the retain cycle. But when I run the code, It causes a memory leak, the controller doesn't call dealloc
method. If I change the ivar to an property, it runs right. I'm so confused about it and search for a long time. please tell me why.
- (void)viewDidLoad {
[super viewDidLoad];
...
@weakify(self);
[RACObserve(self, something) subscribeNext:^(id x) {
@strongify(self);
[_button setBackgroundColor:[UIColor redColor]];
}];
}
- (void)dealloc {
}