これは、__block 変数を nil に設定する必要があるのはなぜですか?の続きです。
基本的にブロックを使用すると、ARCで保持サイクルが発生する可能性がありますが、その理由はまだよくわかりません
-(void)getReviewAndView{
if(![[GrabClass grab] cekInet]){return;}
CM(@"get review and view");
self.viewlbl.text=@"0 view";
self.reviewlbl.text=@"0 review";
Business * businessReviewed = [BNUtilitiesQuick currentBusiness];
NSString *alamat=[NSString stringWithFormat:@"http://...",businessReviewed.ID];
CLog(@"alamat:%@", alamat);
__block NSDictionary * dic = nil;
[Tools doBackground:^{
dic=(NSDictionary *)[GrabClass JsonParser:alamat]; //dic get set here
[Tools doForeGround:^{
NSString *countView= [[dic objectForKey:businessReviewed.ID] objectForKey:@"CountViews"];
CLog(@"countView:%@", countView);
NSString *countReview=[[dic objectForKey:businessReviewed.ID] objectForKey:@"Review"]; //dic get used here
NSString * reviews=@"review";
NSString * view=@"view";
//blablabla
self.viewlbl.text=[NSString stringWithFormat:@"%@ %@",countView,view ];
self.reviewlbl.text=[NSString stringWithFormat:@"%@ %@",countReview,reviews];
dic =nil; //should this be called? What happen if it doesn't?
}];
}];
}