以下提示點擊數是在一個視圖控制器應用程序崩潰時在IOS
-(void)saveProducts {
pData = [[JsonModel sharedJsonModel] prodData];
if ([pData count] == 0 && [self respondsToSelector:@selector(alertView:clickedButtonAtIndex:) ] ) {
alert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"No products against this category" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
[self.tblView reloadData];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0) {
[self.navigationController popViewControllerAnimated:YES];
[actInd stopAnimating];
}
}
但在速度較慢的網絡顯示警報代碼,警報就會慢慢來吧。如果我們同時點擊導航欄的後退按鈕,則彈出導航控制器並在新視圖控制器中顯示警報。但是,當我點擊確定,應用程序突然崩潰與EXC_BAD_ACCESS錯誤。 我也試過
didDismissWithButtonIndex
功能,而不是
clickedButtonAtIndex
但同樣的錯誤發生。請幫我
如果我們沒有點擊後退按鈕,它會正常工作。問題只出現時在第二視圖控制器第一視圖控制器警報顯示
EDIT 這是錯誤報告 * - [ProductsListing alertView:didDismissWithButtonIndex:]:消息發送到釋放的實例0x8478280
編輯 我明白這個問題。當我點擊後退按鈕時,我的警報委託釋放並委託調用結果錯誤。我該如何克服這一點?
請張貼堆棧跟蹤。 – trojanfoe 2013-02-12 12:20:53
是當前視圖 - 控制導航堆棧的第一個視圖控制器和做navigationController頭這個視圖 - 控制 – AppleDelegate 2013-02-12 12:25:45
不,這不是第一個視圖控制器 – manujmv 2013-02-12 12:55:05