问题:我不断收到 EXC_BAD_ACCESS。在我打开 NSZombieEnabled 之后,我看到了这个 [FeatureCommentListViewController respondsToSelector:]: message sent to deallocated instance 0x7c1dc30
在我把项目改成ARC之前没有这个错误,但是我改成ARC之后就出现了这个错误。
我在 Block 中声明了一个 ViewController 并将其推送到导航控制器中。这个原因会导致它的寿命更短吗?
UIBlockButton 来自这篇文章
UIBlockButton *lbGood3 = [[UIBlockButton alloc] initWithFrame:CGRectMake(0, 0, First_Button_Width, [self getGoodRow2Height:productDetail]) ]; [lbGood3 handleControlEvent:UIControlEventTouchUpInside withBlock:^ { NSLog(@"%@", Label.text); ProductDetail *productDetail = [productDetailDict objectForKey:@"product"]; NSString *dp_id = [NSString stringWithFormat:@"%@-%@",productDetail.url_crc,productDetail.site_id]; FeatureCommentListViewController *cmtListController = [[FeatureCommentListViewController alloc] initWithNibName:@"FeatureCommentListViewController" bundle:nil]; cmtListController.title = Label.text; cmtListController.isReviewed=isReviewed; cmtListController.productDetail=productDetail; cmtListController.dp_id=dp_id; cmtListController.feature_name = @"&feature_good_id=2"; [self.navigationController pushViewController:cmtListController animated:YES]; }];
我应该将控制器声明为这个 viewController 的成员还是只声明出块?