block中引用self 时避免循环引用的方法

__weak  LazyTableAppDelegate *weakSelf =self;

self.parser.errorHandler= ^(NSError*parseError) {

dispatch_async(dispatch_get_main_queue(), ^{

[UIApplicationsharedApplication].networkActivityIndicatorVisible=NO;//是否显示网络请求转圈

[weakSelfhandleError:parseError];

});

};

// referencing parser from within its completionBlock would create a retain cycle

__weak ParseOperation *weakParser =self.parser;

你可能感兴趣的:(block中引用self 时避免循环引用的方法)