0

問題: EXC_BAD_ACCESS を取得し続けます。NSZombieEnabled を開いた後、[FeatureCommentListViewController RespondsToSelector:]: 割り当て解除されたインスタンス 0x7c1dc30 にメッセージが送信されました。

  1. プロジェクトを ARC に変更する前は、そのようなエラーはありませんでしたが、ARC に変更した後、このエラーが表示されました。

  2. ViewController を Block で宣言し、それを Navigation Controller にプッシュします。この理由により、寿命が短くなりますか?

    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のメンバーとして宣言するか、ブロックから宣言する必要がありますか?

4

2 に答える 2

0

viewDidLoad関数にFeatureCommentListViewControllerを割り当て、ブロックで使用することでこれを解決しました。

于 2012-07-16T10:00:58.347 に答える
-2

1st . メインスレッドではなく、ブロックにView Controllerをプッシュするのはなぜですか? タッチ操作に素早く反応することが重要ではないでしょうか?

2番目[self.navigationController pushViewController:cmtListController animated:YES];あなたのブロックにあります。あなたが現在を離れるときはいつでも、それはnavigationController何をself.navigationController表しますか?

3番目。ブロックの out を宣言する場合、Hermann Klecker が述べているようviewControllerに、ブロックの前に追加できます。__block

于 2012-07-12T15:15:11.360 に答える