對象在ARC模式下解除分配並導致崩潰。我的代碼在下面;對象在ARC模式下解除分配
BlockAlertView* alert = [BlockAlertView alertWithTitle:title message:message];
[alert setCancelButtonWithTitle:NSLocalizedString(@"No", @"No Button") block:nil];
[alert addButtonWithTitle:NSLocalizedString(@"Yes", @"Yes Button") block:^{
//Do Something
}];
[alert show];
它看起來是正確的警報視圖(這是自定義UIView),但當我點擊其中一個按鈕它崩潰。
崩潰日誌;
2015-04-07 22:28:17.065 Test[3213:781570] <BlockAlertView: 0x16bb4160> 2015-04-07 22:33:01.746 Test[3213:781570] *** -[BlockAlertView performSelector:withObject:withObject:]: message sent to deallocated instance 0x16bb4160
這裏是BlockAlertView的源代碼;
現在我不能估計任何線索這個的,使我老了。 任何輸入將不勝感激!
什麼是'BlockAlertView'?顯示它的代碼。 – Wain
這是我寫的並且比較長。不知道如何向你展示,甚至它在那裏,它可以成爲釋放的原因嗎? – vichevstefan
當然,創建和調用'show'本身並不是'alert'被保留的原因... – Wain