Tag: libextobjc

iOS正确使用@weakify(self)和@strongify(self)

我开始将libextobjc( https://github.com/jspahrsummers/libextobjc )集成到我的iOS应用程序中,主要是为了利用EXTScope的@strongify和@weakify ,但在深入研究这个过程之前,有几个问题。 下面是一个故意过于复杂的例子,试图解决如何处理这个问题: – (void)someMethod { if (self.someBOOL) { _someObjectInstanceVar = [Object objectWithCompletionHandler:^{ // self reference #1 if (self.someProperty) { // self reference #2 [[Async HTTPRequest] sendAWithID:self.property.id completionHandler:^(void (^)(NewObject *newObject) { // self reference #3 [self showViewWithObject:newObject handler:^{ // self reference #4 [self reloadData]; }]; }]; } }]; else { [[Async HTTPRequest] sendBWithID:self.property.id […]